diff --git a/.gitattributes b/.gitattributes index bdb0cabc..0b7c43d4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,13 +5,13 @@ *.cs diff=csharp # Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain +*.doc diff=astextplain +*.DOC diff=astextplain *.docx diff=astextplain *.DOCX diff=astextplain *.dot diff=astextplain *.DOT diff=astextplain *.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f5c3228..4892923f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ We accept contributions via Pull Requests on [Github](https://github.com/XoopsMo - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). - **Add tests!** - We encourage providing tests for your contributions. -- **Document any change in behavior** - Make sure the `/docs/changelog.txt` and any other relevant documentation are kept up-to-date. +- **Document any change in behavior** - Make sure the `/docs/changelog.txt` and any other relevant documentation are up-to-date. - **Consider our release cycle** - We try to follow [Semantic Versioning v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. - **Create feature branches** - Don't ask us to pull from your master branch. - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. diff --git a/README.md b/README.md index 63e660d4..8d703339 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,4 @@ To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/ Please visit us on https://xoops.org -Current and upcoming "next generation" versions of XOOPS CMS are being crafted on GitHub at: https://github.com/XOOPS +Current and upcoming "next generation" versions of XOOPS CMS are crafted on GitHub at: https://github.com/XOOPS diff --git a/admin/about.php b/admin/about.php index e1976516..0dd8b4d8 100644 --- a/admin/about.php +++ b/admin/about.php @@ -16,7 +16,6 @@ * * @copyright The XOOPS Project (https://xoops.org) * @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/) - * @package Publisher * @since 1.0 * @author Mage, Mamba */ diff --git a/admin/admin_footer.php b/admin/admin_footer.php index d3a25775..e872fea6 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -14,11 +14,9 @@ /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package * @since * @author XOOPS Development Team */ - $pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); echo "
\n" . "
\n" . " XOOPS\n" . "
\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '
'; diff --git a/admin/admin_header.php b/admin/admin_header.php index cd31ce63..957acae0 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -14,30 +14,29 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory */ -use XoopsModules\Publisher; +use Xmf\Module\Admin; +use XoopsModules\Publisher\Helper; require dirname(__DIR__) . '/preloads/autoloader.php'; -require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; +require_once dirname(__DIR__, 3) . '/include/cp_header.php'; //require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); require_once dirname(__DIR__) . '/include/common.php'; $moduleDirName = basename(dirname(__DIR__)); -/** @var \XoopsModules\Publisher\Helper $helper */ -$helper = \XoopsModules\Publisher\Helper::getInstance(); +$helper = Helper::getInstance(); /** @var Xmf\Module\Admin $adminObject */ -$adminObject = \Xmf\Module\Admin::getInstance(); +$adminObject = Admin::getInstance(); -$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); -$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); +$pathIcon16 = Admin::iconUrl('', 16); +$pathIcon32 = Admin::iconUrl('', 32); if (is_object($helper->getModule())) { $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); } diff --git a/admin/blockform.php b/admin/blockform.php index e8cca8b6..736b6147 100644 --- a/admin/blockform.php +++ b/admin/blockform.php @@ -24,8 +24,8 @@ if (isset($block['name'])) { $form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_NAME, $block['name'])); } -$side_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_TYPE, 'bside', $block['side']); -$side_select->addOptionArray( +$sideSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_TYPE, 'bside', $block['side']); +$sideSelect->addOptionArray( [ 0 => _AM_SYSTEM_BLOCKS_SBLEFT, 1 => _AM_SYSTEM_BLOCKS_SBRIGHT, @@ -37,27 +37,27 @@ 9 => _AM_SYSTEM_BLOCKS_CBBOTTOM, ] ); -$form->addElement($side_select); +$form->addElement($sideSelect); $form->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT'), 'bweight', 2, 5, $block['weight'])); $form->addElement(new \XoopsFormRadioYN(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE'), 'bvisible', $block['visible'])); -$mod_select = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true); +$moduleSelect = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true); /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $criteria = new \CriteriaCompo(new \Criteria('hasmain', 1)); $criteria->add(new \Criteria('isactive', 1)); -$module_list = $moduleHandler->getList($criteria); -$module_list[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; -$module_list[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; -ksort($module_list); -$mod_select->addOptionArray($module_list); -$form->addElement($mod_select); +$moduleList = $moduleHandler->getList($criteria); +$moduleList[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; +$moduleList[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; +ksort($moduleList); +$moduleSelect->addOptionArray($moduleList); +$form->addElement($moduleSelect); $form->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . '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 . '/') . ''); $form->addElement($textarea, true); - $ctype_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']); - $ctype_select->addOptionArray( + $ctypeSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_CTYPE, 'bctype', $block['ctype']); + $ctypeSelect->addOptionArray( [ 'H' => _AM_SYSTEM_BLOCKS_HTML, 'P' => _AM_SYSTEM_BLOCKS_PHP, @@ -65,7 +65,7 @@ 'T' => _AM_SYSTEM_BLOCKS_AFNOSMILE, ] ); - $form->addElement($ctype_select); + $form->addElement($ctypeSelect); } else { if ('' !== $block['template']) { /** @var \XoopsTplfileHandler $tplfileHandler */ @@ -84,8 +84,8 @@ $form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_OPTIONS, $block['edit_form'])); } } -$cache_select = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']); -$cache_select->addOptionArray( +$cacheSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']); +$cacheSelect->addOptionArray( [ '0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), @@ -100,7 +100,7 @@ '2592000' => _MONTH, ] ); -$form->addElement($cache_select); +$form->addElement($cacheSelect); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); @@ -120,11 +120,11 @@ //Submit buttons $buttonTray = new \XoopsFormElementTray('', ''); -$submit_button = new \XoopsFormButton('', 'submitblock', _SUBMIT, 'submit'); -$buttonTray->addElement($submit_button); +$submitButton = new \XoopsFormButton('', 'submitblock', _SUBMIT, 'submit'); +$buttonTray->addElement($submitButton); -$cancel_button = new \XoopsFormButton('', '', _CANCEL, 'button'); -$cancel_button->setExtra('onclick="history.go(-1)"'); -$buttonTray->addElement($cancel_button); +$cancelButton = new \XoopsFormButton('', '', _CANCEL, 'button'); +$cancelButton->setExtra('onclick="history.go(-1)"'); +$buttonTray->addElement($cancelButton); $form->addElement($buttonTray); diff --git a/admin/blocksadmin.php b/admin/blocksadmin.php index 13045ac2..4388436e 100644 --- a/admin/blocksadmin.php +++ b/admin/blocksadmin.php @@ -16,6 +16,7 @@ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) */ +use Xmf\Module\Admin; use Xmf\Request; require __DIR__ . '/admin_header.php'; @@ -47,7 +48,7 @@ */ $op = Request::getString('op', $op); - if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'])) { + if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'], true)) { $bid = Request::getInt('bid', 0, 'GET'); } @@ -59,7 +60,7 @@ function listBlocks() require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName - /** @var \XoopsDatabase $db */ + /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/blocksadmin', 'system'); @@ -74,10 +75,10 @@ function listBlocks() $groups = $memberHandler->getGroups(); $criteria = new \CriteriaCompo(new \Criteria('hasmain', 1)); $criteria->add(new \Criteria('isactive', 1)); - $module_list = $moduleHandler->getList($criteria); - $module_list[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; - $module_list[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; - ksort($module_list); + $moduleList = $moduleHandler->getList($criteria); + $moduleList[-1] = _AM_SYSTEM_BLOCKS_TOPPAGE; + $moduleList[0] = _AM_SYSTEM_BLOCKS_ALLPAGES; + ksort($moduleList); echo "

" . constant('CO_' . $moduleDirNameUpper . '_' . 'BADMIN') . '

'; // $moduleHandler = xoops_getHandler('module'); @@ -110,8 +111,8 @@ function listBlocks() . constant('CO_' . $moduleDirNameUpper . '_' . 'ACTION') . ' '; - $block_arr = \XoopsBlock::getByModule($xoopsModule->mid()); - $block_count = count($block_arr); + $blockArray = \XoopsBlock::getByModule($xoopsModule->mid()); + $blockCount = count($blockArray); $class = 'even'; $cachetimes = [ '0' => _NOCACHE, @@ -126,8 +127,8 @@ function listBlocks() '604800' => _WEEK, '2592000' => _MONTH, ]; - foreach ($block_arr as $i) { - $groups_perms = $grouppermHandler->getGroupIds('block_read', $i->getVar('bid')); + foreach ($blockArray as $i) { + $groupsPerms = $grouppermHandler->getGroupIds('block_read', $i->getVar('bid')); $sql = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . $i->getVar('bid'); $result = $db->query($sql); $modules = []; @@ -135,12 +136,12 @@ function listBlocks() $modules[] = (int)$row['module_id']; } - $cachetime_options = ''; - foreach ($cachetimes as $cachetime => $cachetime_name) { + $cachetimeOptions = ''; + foreach ($cachetimes as $cachetime => $cachetimeName) { if ($i->getVar('bcachetime') == $cachetime) { - $cachetime_options .= "\n"; + $cachetimeOptions .= "\n"; } else { - $cachetime_options .= "\n"; + $cachetimeOptions .= "\n"; } } @@ -239,19 +240,19 @@ function listBlocks() . ''; echo "'; echo "'; // Cache lifetime - echo ' + echo ' '; // Actions @@ -294,7 +295,7 @@ function cloneBlock($bid) xoops_cp_header(); /** @var \Xmf\Module\Admin $adminObject */ - $adminObject = \Xmf\Module\Admin::getInstance(); + $adminObject = Admin::getInstance(); $adminObject->displayNavigation(basename(__FILE__)); $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName @@ -312,7 +313,7 @@ function cloneBlock($bid) while (false !== ($row = $db->fetchArray($result))) { $modules[] = (int)$row['module_id']; } - $is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type')); + $isCustom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type')); $block = [ 'title' => $myblock->getVar('title') . ' Clone', 'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK'), @@ -322,7 +323,7 @@ function cloneBlock($bid) 'visible' => $myblock->getVar('visible'), 'content' => $myblock->getVar('content', 'N'), 'modules' => $modules, - 'is_custom' => $is_custom, + 'is_custom' => $isCustom, 'ctype' => $myblock->getVar('c_type'), 'bcachetime' => $myblock->getVar('bcachetime'), 'op' => 'clone_ok', @@ -333,7 +334,7 @@ function cloneBlock($bid) ]; echo '' . constant('CO_' . $moduleDirNameUpper . '_' . 'BADMIN') . ' »» ' . _AM_SYSTEM_BLOCKS_CLONEBLOCK . '

'; require_once __DIR__ . '/blockform.php'; - /* @var XoopsThemeForm $form */ + /** @var XoopsThemeForm $form */ $form->display(); // xoops_cp_footer(); require_once __DIR__ . '/admin_footer.php'; @@ -355,7 +356,6 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, xoops_loadLanguage('admin/blocksadmin', 'system'); xoops_loadLanguage('admin/groups', 'system'); - /** @var \XoopsBlock $block */ $block = new \XoopsBlock($bid); $clone = $block->xoopsClone(); if (empty($bmodule)) { @@ -439,7 +439,7 @@ function editBlock($bid) require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); /** @var \Xmf\Module\Admin $adminObject */ - $adminObject = \Xmf\Module\Admin::getInstance(); + $adminObject = Admin::getInstance(); $adminObject->displayNavigation(basename(__FILE__)); $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName @@ -456,7 +456,7 @@ function editBlock($bid) while (false !== ($row = $db->fetchArray($result))) { $modules[] = (int)$row['module_id']; } - $is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type')); + $isCustom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type')); $block = [ 'title' => $myblock->getVar('title'), 'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK'), @@ -466,7 +466,7 @@ function editBlock($bid) 'visible' => $myblock->getVar('visible'), 'content' => $myblock->getVar('content', 'N'), 'modules' => $modules, - 'is_custom' => $is_custom, + 'is_custom' => $isCustom, 'ctype' => $myblock->getVar('c_type'), 'bcachetime' => $myblock->getVar('bcachetime'), 'op' => 'edit_ok', @@ -477,7 +477,7 @@ function editBlock($bid) ]; echo '' . constant('CO_' . $moduleDirNameUpper . '_' . 'BADMIN') . ' »» ' . _AM_SYSTEM_BLOCKS_EDITBLOCK . '

'; require_once __DIR__ . '/blockform.php'; - /* @var XoopsThemeForm $form */ + /** @var XoopsThemeForm $form */ $form->display(); // xoops_cp_footer(); require_once __DIR__ . '/admin_footer.php'; @@ -506,10 +506,10 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b $myblock->setVar('bcachetime', $bcachetime); //update block options if (isset($options)) { - $options_count = count($options); - if ($options_count > 0) { + $optionsCount = count($options); + if ($optionsCount > 0) { //Convert array values to comma-separated - for ($i = 0; $i < $options_count; ++$i) { + for ($i = 0; $i < $optionsCount; ++$i) { if (is_array($options[$i])) { $options[$i] = implode(',', $options[$i]); } @@ -525,7 +525,7 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b if (!empty($bmodule) && count($bmodule) > 0) { $sql = sprintf('DELETE FROM `%s` WHERE block_id = %u', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid); $GLOBALS['xoopsDB']->query($sql); - if (in_array(0, $bmodule)) { + if (in_array(0, $bmodule, true)) { $sql = sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid, 0); $GLOBALS['xoopsDB']->query($sql); } else { @@ -562,12 +562,12 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b if ($oldtitle[$i] !== $title[$i] || $oldweight[$i] !== $weight[$i] || $oldvisible[$i] !== $visible[$i] || $oldside[$i] !== $side[$i] || $oldbcachetime[$i] !== $bcachetime[$i]) { - setOrder($bid[$i], $title[$i], $weight[$i], $visible[$i], $side[$i], $bcachetime[$i], $bmodule[$i]); + setOrder($bid[$i], $title[$i], $weight[$i], $visible[$i], $side[$i], $bcachetime[$i], $bmodule[$i]=null); } if (!empty($bmodule[$i]) && count($bmodule[$i]) > 0) { $sql = sprintf('DELETE FROM `%s` WHERE block_id = %u', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid[$i]); $GLOBALS['xoopsDB']->query($sql); - if (in_array(0, $bmodule[$i])) { + if (in_array(0, $bmodule[$i], true)) { $sql = sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid[$i], 0); $GLOBALS['xoopsDB']->query($sql); } else { diff --git a/admin/category.php b/admin/category.php index 2c299266..59d77c46 100644 --- a/admin/category.php +++ b/admin/category.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -22,6 +21,7 @@ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; @@ -32,11 +32,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) { @@ -52,19 +52,19 @@ break; case 'mod': //Added by fx2024 - $nb_subcats = Request::getInt('nb_subcats', 0, 'POST'); - $nb_subcats += Request::getInt('nb_sub_yet', 4, 'POST'); + $numberSubcats = Request::getInt('nb_subcats', 0, 'POST'); + $numberSubcats += Request::getInt('nb_sub_yet', 4, 'POST'); //end of fx2024 code - Publisher\Utility::cpHeader(); - Publisher\Utility::editCategory(true, $categoryid, $nb_subcats); + Utility::cpHeader(); + 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(); } @@ -72,23 +72,23 @@ // Uploading the image, if any // Retreive the filename to be uploaded $temp = Request::getArray('image_file', '', 'FILES'); - $image_file = $temp['name']; - if ($image_file) { + $imageFile = $temp['name']; + if ($imageFile) { // $filename = Request::getArray('xoops_upload_file', array(), 'POST')[0]; $temp2 = Request::getArray('xoops_upload_file', [], 'POST'); $filename = $temp2[0]; if ($filename) { // TODO : implement publisher mimetype management - $max_size = $helper->getConfig('maximum_filesize'); - $max_imgwidth = $helper->getConfig('maximum_image_width'); - $max_imgheight = $helper->getConfig('maximum_image_height'); - $allowed_mimetypes = Publisher\Utility::getAllowedImagesTypes(); + $maxSize = $helper->getConfig('maximum_filesize'); + $maxImageWidth = $helper->getConfig('maximum_image_width'); + $maxImageHeight = $helper->getConfig('maximum_image_height'); + $allowedMimetypes = Utility::getAllowedImagesTypes(); if (('' == $temp['tmp_name']) || !is_readable($temp['tmp_name'])) { redirect_header('', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); } xoops_load('XoopsMediaUploader'); - $uploader = new \XoopsMediaUploader(Publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); + $uploader = new \XoopsMediaUploader(Utility::getImageDir('category'), $allowedMimetypes, $maxSize, $maxImageWidth, $maxImageHeight); if ($uploader->fetchMedia($filename) && $uploader->upload()) { $categoryObj->setVar('image', $uploader->getSavedFileName()); } else { @@ -120,20 +120,20 @@ $categoryObj->setVar('header', Request::getText('header', '', 'POST')); if ($categoryObj->isNew()) { - $redirect_msg = _AM_PUBLISHER_CATCREATED; - $redirect_to = 'category.php?op=mod'; + $redirectMsg = _AM_PUBLISHER_CATCREATED; + $redirectTo = 'category.php?op=mod'; } else { - $redirect_msg = _AM_PUBLISHER_COLMODIFIED; - $redirect_to = 'category.php'; + $redirectMsg = _AM_PUBLISHER_COLMODIFIED; + $redirectTo = 'category.php'; } if (!$categoryObj->store()) { - redirect_header('', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . Publisher\Utility::formatErrors($categoryObj->getErrors())); + redirect_header('', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . Utility::formatErrors($categoryObj->getErrors())); } // TODO : put this function in the category class - Publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - Publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - Publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); //Added by fx2024 $parentCat = $categoryObj->categoryid(); @@ -147,22 +147,22 @@ $categoryObj->setVar('parentid', $parentCat); if (!$categoryObj->store()) { - redirect_header('', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . Publisher\Utility::formatErrors($categoryObj->getErrors())); + redirect_header('', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . Utility::formatErrors($categoryObj->getErrors())); } // TODO : put this function in the category class - Publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - Publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - Publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); } } //end of fx2024 code - redirect_header($redirect_to, 2, $redirect_msg); + redirect_header($redirectTo, 2, $redirectMsg); break; //Added by fx2024 case 'addsubcats': - $categoryid = 0; - $nb_subcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST'); + $categoryId = 0; + $numberSubcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST'); $categoryObj = $helper->getHandler('Category')->create(); $categoryObj->setVar('name', Request::getString('name', '', 'POST')); @@ -172,8 +172,8 @@ $categoryObj->setVar('parentid', $parentCat); } - Publisher\Utility::cpHeader(); - Publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj); + Utility::cpHeader(); + Utility::editCategory(true, $categoryId, $numberSubcats, $categoryObj); exit(); break; //end of fx2024 code @@ -183,7 +183,7 @@ break; case 'default': default: - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); echo "
\n"; @@ -195,7 +195,7 @@ // Creating the objects for top categories $categoriesObj = $helper->getHandler('Category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0); - Publisher\Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); + Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); echo ""; echo ''; @@ -207,21 +207,21 @@ $totalCategories = $helper->getHandler('Category')->getCategoriesCount(0); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $key => $thiscat) { - Publisher\Utility::displayCategory($thiscat); + Utility::displayCategory($thiscat); } unset($key, $thiscat); } else { echo ''; echo "'; echo ''; - $categoryid = '0'; + $categoryId = '0'; } echo "
" . _AM_PUBLISHER_NOCAT . '
\n"; require_once $GLOBALS['xoops']->path('class/pagenav.php'); $pagenav = new \XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); echo '
' . $pagenav->renderNav() . '
'; echo '
'; - Publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); + Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); echo '
'; //editcat(false); break; diff --git a/admin/clone.php b/admin/clone.php index 8155e5ef..dd3c3fca 100644 --- a/admin/clone.php +++ b/admin/clone.php @@ -14,19 +14,19 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; -Publisher\Utility::cpHeader(); +Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); -Publisher\Utility::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); +Utility::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); if ('submit' === Request::getString('op', '', 'POST')) { if (!$GLOBALS['xoopsSecurity']->check()) { @@ -79,7 +79,7 @@ } // End of collapsable bar -Publisher\Utility::closeCollapsableBar('clone', 'cloneicon'); +Utility::closeCollapsableBar('clone', 'cloneicon'); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/feedback.php b/admin/feedback.php index d18a1cfe..63dbfb6f 100644 --- a/admin/feedback.php +++ b/admin/feedback.php @@ -22,12 +22,13 @@ */ use Xmf\Request; +use \XoopsModules\Publisher\Common\ModuleFeedback; require __DIR__ . '/admin_header.php'; $adminObject = \Xmf\Module\Admin::getInstance(); -$feedback = new \XoopsModules\Publisher\Common\ModuleFeedback(); +$feedback = new ModuleFeedback(); // It recovered the value of argument op in URL$ $op = Request::getString('op', 'list'); @@ -44,8 +45,7 @@ $feedback->name = $GLOBALS['xoopsUser']->getVar('name'); $feedback->email = $GLOBALS['xoopsUser']->getVar('email'); $feedback->site = XOOPS_URL; - /** @var \XoopsThemeForm $form */ - $form = $feedback->getFormFeedback(); + $form = $feedback->getFormFeedback(); echo $form->display(); break; case 'send': @@ -58,14 +58,14 @@ $your_name = Request::getString('your_name', ''); $your_site = Request::getString('your_site', ''); - $your_mail = Request::getString('your_mail', ''); + $yourMail = Request::getString('your_mail', ''); $fb_type = Request::getString('fb_type', ''); $fb_content = Request::getText('fb_content', ''); $fb_content = str_replace(["\r\n", "\n", "\r"], '
', $fb_content); //clean line break from dhtmltextarea $title = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname'); $body = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '
'; - $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '
'; + $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $yourMail . '
'; $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '
'; $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '

'; $body .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':
'; @@ -73,7 +73,7 @@ $xoopsMailer = xoops_getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($GLOBALS['xoopsModule']->getInfo('author_mail')); - $xoopsMailer->setFromEmail($your_mail); + $xoopsMailer->setFromEmail($yourMail); $xoopsMailer->setFromName($your_name); $xoopsMailer->setSubject($title); $xoopsMailer->multimailer->isHTML(true); @@ -85,7 +85,7 @@ // show form with content again $feedback->name = $your_name; - $feedback->email = $your_mail; + $feedback->email = $yourMail; $feedback->site = $your_site; $feedback->type = $fb_type; $feedback->content = $fb_content; diff --git a/admin/file.php b/admin/file.php index 329e6729..b350ef6a 100644 --- a/admin/file.php +++ b/admin/file.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -22,6 +21,8 @@ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Helper; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; @@ -30,12 +31,11 @@ /** * @param bool $showmenu * @param int $fileid - * @param int $itemid + * @param int $itemId */ -function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) +function publisher_editFile($showmenu = false, $fileid = 0, $itemId = 0) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); // if there is a parameter, and the id exists, retrieve data: we're editing a file @@ -51,14 +51,14 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) echo "
\n"; echo "" . _AM_PUBLISHER_FILE_EDITING . ''; echo '' . _AM_PUBLISHER_FILE_EDITING_DSC . ''; - Publisher\Utility::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + Utility::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); + $fileObj->setVar('itemid', $itemId); echo "" . _AM_PUBLISHER_FILE_ADDING . ''; echo '' . _AM_PUBLISHER_FILE_ADDING_DSC . ''; - Publisher\Utility::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + Utility::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM @@ -67,9 +67,9 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) $uploadForm->display(); if (0 != $fileid) { - Publisher\Utility::closeCollapsableBar('editfile', 'editfileicon'); + Utility::closeCollapsableBar('editfile', 'editfileicon'); } else { - Publisher\Utility::closeCollapsableBar('addfile', 'addfileicon'); + Utility::closeCollapsableBar('addfile', 'addfileicon'); } } @@ -77,24 +77,24 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) /* -- Available operations -- */ switch ($op) { case 'uploadfile': - Publisher\Utility::uploadFile(false, true, $false); + Utility::uploadFile(false, true, $false); exit; break; case 'uploadanother': - Publisher\Utility::uploadFile(true, true, $false); + Utility::uploadFile(true, true, $false); exit; break; case 'mod': $fileid = Request::getInt('fileid', 0, 'GET'); - $itemid = Request::getInt('itemid', 0, 'GET'); - if ((0 == $fileid) && (0 == $itemid)) { + $itemId = Request::getInt('itemid', 0, 'GET'); + if ((0 == $fileid) && (0 == $itemId)) { redirect_header('', 3, _AM_PUBLISHER_NOITEMSELECTED); } - Publisher\Utility::cpHeader(); + Utility::cpHeader(); require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); - publisher_editFile(true, $fileid, $itemid); + publisher_editFile(true, $fileid, $itemId); break; case 'modify': $fileid = Request::getInt('fileid', 0, 'POST'); @@ -113,7 +113,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) // Storing the file if (!$fileObj->store()) { - redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 3, _AM_PUBLISHER_FILE_EDITING_ERROR . Publisher\Utility::formatErrors($fileObj->getErrors())); + redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 3, _AM_PUBLISHER_FILE_EDITING_ERROR . Utility::formatErrors($fileObj->getErrors())); } redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS); @@ -137,7 +137,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) // no confirm: show deletion condition $fileid = Request::getInt('fileid', 0, 'GET'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); xoops_confirm(['op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()], 'file.php', _AM_PUBLISHER_DELETETHISFILE . '
' . $fileObj->name() . '

', _AM_PUBLISHER_DELETE); xoops_cp_footer(); } @@ -146,7 +146,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) break; case 'default': default: - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); break; } diff --git a/admin/import.php b/admin/import.php index 51016110..7517b320 100644 --- a/admin/import.php +++ b/admin/import.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -22,6 +21,7 @@ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; @@ -37,13 +37,13 @@ default: $importfile = 'none'; - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('import', 'importicon', _AM_PUBLISHER_IMPORT_TITLE, _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('import', 'importicon', _AM_PUBLISHER_IMPORT_TITLE, _AM_PUBLISHER_IMPORT_INFO); xoops_load('XoopsFormLoader'); - /* @var \XoopsModuleHandler $moduleHandler */ + /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); // WF-Section @@ -175,7 +175,7 @@ // End of collapsable bar - Publisher\Utility::closeCollapsableBar('import', 'importicon'); + Utility::closeCollapsableBar('import', 'importicon'); break; } diff --git a/admin/import/ams.php b/admin/import/ams.php index 0cfb57ce..b38aff2e 100644 --- a/admin/import/ams.php +++ b/admin/import/ams.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,6 +23,7 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -37,9 +37,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('amsimport', 'amsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('amsimport', 'amsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('ams_topics')); [$totalCat] = $GLOBALS['xoopsDB']->fetchRow($result); @@ -81,7 +81,7 @@ try { $imageCategoryHandler->insert($imagecategory); - } catch (\Exception $e) { + } catch (\Throwable $e) { echo 'Caught exception: could not insert Image Category' . $e->getMessage() . 'n'; } @@ -90,7 +90,7 @@ if (!isset($readgroup)) { $readgroup = []; } - if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { + if (!in_array(XOOPS_GROUP_ADMIN, $readgroup, true)) { $readgroup[] = XOOPS_GROUP_ADMIN; } foreach ($readgroup as $rgroup) { @@ -106,7 +106,7 @@ if (!isset($writegroup)) { $writegroup = []; } - if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { + if (!in_array(XOOPS_GROUP_ADMIN, $writegroup, true)) { $writegroup[] = XOOPS_GROUP_ADMIN; } foreach ($writegroup as $wgroup) { @@ -126,16 +126,16 @@ $sql = 'SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM ' . $GLOBALS['xoopsDB']->prefix('ams_topics') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('nw_stories') . ' AS art ON cat.topic_id=art.topicid GROUP BY art.topicid'; $result = $GLOBALS['xoopsDB']->query($sql); - $cat_cbox_options = []; + $catCboxOptions = []; - while (list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "$cat_title ($art_count)"; + while (list($cid, $pid, $catTitle, $articleCount) = $GLOBALS['xoopsDB']->fetchRow($result)) { + $catTitle = $myts->displayTarea($catTitle); + $catCboxOptions[$cid] = "$catTitle ($articleCount)"; } - $cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); - $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); - $form->addElement($cat_label); + $catLabel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $catCboxOptions)); + $catLabel->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); + $form->addElement($catLabel); // Publisher parent category $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix($helper->getModule()->dirname() . '_categories'), 'categoryid', 'parentid'); @@ -156,21 +156,21 @@ } } - Publisher\Utility::closeCollapsableBar('amsimport', 'amsimporticon'); + Utility::closeCollapsableBar('amsimport', 'amsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); // require_once dirname(dirname(__DIR__)) . '/include/common.php'; - Publisher\Utility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - /* @var XoopsModuleHandler $moduleHandler */ + Utility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('ams'); $ams_module_id = $moduleObj->getVar('mid'); - /* @var XoopsGroupPermHandler $grouppermHandler */ + /** @var XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); $cnt_imported_cat = 0; @@ -219,7 +219,7 @@ $newCat = []; $newCat['oldid'] = $arrCat['topic_id']; $newCat['oldpid'] = $arrCat['topic_pid']; - /* @var Publisher\Category $categoryObj */ + /** @var Publisher\Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); $categoryObj->setVar('parentid', $arrCat['topic_pid']); @@ -241,13 +241,13 @@ $imageHandler = xoops_getHandler('image'); $image = $imageHandler->create(); $image->setVar('image_name', $arrCat['topic_imgurl']);//'images/' . $uploader->getSavedFileName()); - $image->setVar('image_nicename', mb_substr($arrCat['topic_imgurl'],-13)); //$image_nicename); + $image->setVar('image_nicename', mb_substr($arrCat['topic_imgurl'],-13)); //$imageNiceName); $image->setVar('image_mimetype', 'image/'. mb_substr($arrCat['topic_imgurl'],-3));//$uploader->getMediaType()); // $image->setVar('image_created', time()); // $image_display = empty($image_display) ? 0 : 1; $image->setVar('image_display', 1); //$image_display); $image->setVar('image_weight', 0);//$image_weight); - $image->setVar('imgcat_id', $newid );//$imgcat_id); + $image->setVar('imgcat_id', $newid );//$imgcatId); if (!$imageHandler->insert($image)) { $err[] = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename')); } @@ -267,7 +267,7 @@ $src = $GLOBALS['xoops']->path('uploads/AMS/topics/'); $dst = $GLOBALS['xoops']->path('uploads'); - Publisher\Utility::recurseCopy($src, $dst); + Utility::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) @@ -353,7 +353,7 @@ // Linkes files $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('ams_article_files') . ' WHERE storyid=' . $arrArticle['storyid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); - $allowed_mimetypes = ''; + $allowedMimetypes = ''; while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles))) { $filename = $GLOBALS['xoops']->path('uploads/AMS/attached/' . $arrFile['downloadname']); if (file_exists($filename)) { @@ -371,7 +371,7 @@ $fileObj->setVar('filename', $arrFile['filerealname']); $fileObj->setVar('short_url', $arrFile['filerealname']); - if ($fileObj->store($allowed_mimetypes, true, false)) { + if ($fileObj->store($allowedMimetypes, true, false)) { echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } @@ -387,12 +387,12 @@ // Saving category permissions $groupsIds = $grouppermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $ams_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $grouppermHandler->getGroupIds('nw_submit', $arrCat['topic_id'], $ams_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $groupsIds = $grouppermHandler->getGroupIds('nw_approve', $arrCat['topic_id'], $ams_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -442,6 +442,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - Publisher\Utility::closeCollapsableBar('amsimportgo', 'amsimportgoicon'); + Utility::closeCollapsableBar('amsimportgo', 'amsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/cjaycontent.php b/admin/import/cjaycontent.php index a4dee646..4ac73315 100644 --- a/admin/import/cjaycontent.php +++ b/admin/import/cjaycontent.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,6 +23,7 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -57,9 +57,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('cjaycontentimport', 'cjaycontentimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('cjaycontentimport', 'cjaycontentimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('cjaycontent')); [$totalArticles] = $GLOBALS['xoopsDB']->fetchRow($result); @@ -82,20 +82,20 @@ } // } - Publisher\Utility::closeCollapsableBar('cjaycontentimport', 'cjaycontentimporticon'); + Utility::closeCollapsableBar('cjaycontentimport', 'cjaycontentimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); // require_once dirname(dirname(__DIR__)) . '/include/common.php'; - Publisher\Utility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - /* @var XoopsModuleHandler $moduleHandler */ + Utility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('cjaycontent'); $cjaycontent_module_id = $moduleObj->getVar('mid'); - /* @var XoopsGroupPermHandler $grouppermHandler */ + /** @var XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); $cnt_imported_articles = 0; @@ -185,6 +185,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - Publisher\Utility::closeCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon'); + Utility::closeCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php index 0bbd05b0..ef2b3c9d 100644 --- a/admin/import/fmcontent.php +++ b/admin/import/fmcontent.php @@ -14,17 +14,17 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.02 Beta 4 * @author trabis * @author The SmartFactory * @author Marius Scurtescu - * @author ZySpec + * @author ZySpec */ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -38,10 +38,10 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - /* @var XoopsModuleHandler $moduleHandler */ + Utility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('fmcontent'); $fm_module_id = $moduleObj->getVar('mid'); @@ -72,11 +72,11 @@ . " AS art ON ((cat.topic_id=art.content_topic) AND (cat.topic_modid=art.content_modid)) WHERE cat.topic_modid={$fm_module_id} GROUP BY art.content_topic"; $result = $GLOBALS['xoopsDB']->query($sql); - $cat_cbox_options = []; + $catCboxOptions = []; - while (list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "{$cat_title} ($art_count)"; + while (list($cid, $pid, $catTitle, $articleCount) = $GLOBALS['xoopsDB']->fetchRow($result)) { + $catTitle = $myts->displayTarea($catTitle); + $catCboxOptions[$cid] = "{$catTitle} ($articleCount)"; } // now get articles in the top level category (content_topic=0) $criteria = new \CriteriaCompo(); @@ -84,16 +84,16 @@ $criteria->add(new \Criteria('content_topic', 0)); $cnt_tla_contents = $fmContentHdlr->getCount($criteria); if ($cnt_tla_contents) { - $cat_cbox_options[0] = _AM_PUBLISHER_IMPORT_FMCONTENT_NAME . " ({$cnt_tla_contents})"; + $catCboxOptions[0] = _AM_PUBLISHER_IMPORT_FMCONTENT_NAME . " ({$cnt_tla_contents})"; } - natcasesort($cat_cbox_options); //put them in "alphabetical" order + natcasesort($catCboxOptions); //put them in "alphabetical" order - echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $fmContentCount, count($cat_cbox_options)) . ''; + echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $fmContentCount, count($catCboxOptions)) . ''; $form = new \XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); - $cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); - $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); - $form->addElement($cat_label); + $catLabel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $catCboxOptions)); + $catLabel->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); + $form->addElement($catLabel); // Publisher parent category xoops_load('tree'); @@ -102,7 +102,7 @@ $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); $moduleDirName = basename(dirname(__DIR__)); $module = \XoopsModule::getByDirname($moduleDirName); - if (Publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { + if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); //$form->addElement($catSelBox); } else { @@ -130,19 +130,19 @@ } } - Publisher\Utility::closeCollapsableBar('fmimport', 'fmimporticon'); + Utility::closeCollapsableBar('fmimport', 'fmimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + Utility::openCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('fmcontent'); $fm_module_id = $moduleObj->getVar('mid'); - /* @var XoopsGroupPermHandler $grouppermHandler */ + /** @var XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); $cnt_imported_cat = 0; @@ -162,7 +162,7 @@ ++$cnt_imported_cat; //count category if there was content to import // create Publsher category to hold FmContent Content items with no Topic (content_topic=0) - /* @var Publisher\Category $categoryObj */ + /** @var Publisher\Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); $categoryObj->setVars( [ @@ -228,9 +228,9 @@ // Saving category permissions $groupsIds = $grouppermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $grouppermHandler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); unset($fmContentObjs, $itemObj, $categoryObj, $thisFmContentObj); echo "
\n"; @@ -327,9 +327,9 @@ // Saving category permissions $groupsIds = $grouppermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $grouppermHandler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$catIds['oldid']] = $catIds; unset($catIds, $thisFmContentObj); @@ -385,6 +385,6 @@ . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
\n"; - Publisher\Utility::closeCollapsableBar('fmimportgo', 'fmimportgoicon'); + Utility::closeCollapsableBar('fmimportgo', 'fmimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/news.php b/admin/import/news.php index 76936b5e..3b4eb8d0 100644 --- a/admin/import/news.php +++ b/admin/import/news.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,6 +23,7 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -37,9 +37,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('news_topics')); [$totalCat] = $GLOBALS['xoopsDB']->fetchRow($result); @@ -63,16 +63,16 @@ $sql = 'SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM ' . $GLOBALS['xoopsDB']->prefix('news_topics') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('news_stories') . ' AS art ON cat.topic_id=art.topicid GROUP BY art.topicid'; $result = $GLOBALS['xoopsDB']->query($sql); - $cat_cbox_options = []; + $catCboxOptions = []; - while (list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "$cat_title ($art_count)"; + while (list($cid, $pid, $catTitle, $articleCount) = $GLOBALS['xoopsDB']->fetchRow($result)) { + $catTitle = $myts->displayTarea($catTitle); + $catCboxOptions[$cid] = "$catTitle ($articleCount)"; } - $cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); - $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); - $form->addElement($cat_label); + $catLabel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $catCboxOptions)); + $catLabel->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); + $form->addElement($catLabel); // Publisher parent category $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix($helper->getModule()->getVar('dirname', 'n') . '_categories'), 'categoryid', 'parentid'); @@ -93,19 +93,19 @@ } } - Publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); + Utility::closeCollapsableBar('newsimport', 'newsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - /* @var XoopsModuleHandler $moduleHandler */ + Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('news'); $news_module_id = $moduleObj->getVar('mid'); - /* @var XoopsGroupPermHandler $grouppermHandler */ + /** @var XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); $cnt_imported_cat = 0; @@ -125,7 +125,7 @@ $newCat = []; $newCat['oldid'] = $arrCat['topic_id']; $newCat['oldpid'] = $arrCat['topic_pid']; - /* @var Publisher\Category $categoryObj */ + /** @var Publisher\Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); $categoryObj->setVar('parentid', $arrCat['topic_pid']); @@ -199,7 +199,7 @@ // Linkes files $sql = 'SELECT * FROM '.$GLOBALS['xoopsDB']->prefix('wfs_files').' WHERE articleid=' . $arrArticle['articleid']; $resultFiles = $GLOBALS['xoopsDB']->query ($sql); - $allowed_mimetypes = ''; + $allowedMimetypes = ''; while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray ($resultFiles))) { $filename = $GLOBALS['xoops']->path('modules/wfsection/cache/uploaded/' . $arrFile['filerealname']); @@ -216,7 +216,7 @@ $fileObj->setVar('counter', $arrFile['counter']); $fileObj->setVar('filename', $arrFile['filerealname']); - if ($fileObj->store($allowed_mimetypes, true, false)) { + if ($fileObj->store($allowedMimetypes, true, false)) { echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } @@ -230,9 +230,9 @@ // Saving category permissions $groupsIds = $grouppermHandler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $grouppermHandler->getGroupIds('news_submit', $arrCat['topic_id'], $news_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -281,6 +281,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - Publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/smartsection.php b/admin/import/smartsection.php index 1b9a37e0..d4ba9047 100644 --- a/admin/import/smartsection.php +++ b/admin/import/smartsection.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -23,6 +22,7 @@ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -36,9 +36,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories')); [$totalCat] = $GLOBALS['xoopsDB']->fetchRow($result); @@ -62,16 +62,16 @@ $sql = 'SELECT cat.categoryid, cat.parentid, cat.name, COUNT(art.itemid) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('smartsection_items') . ' AS art ON cat.categoryid=art.categoryid GROUP BY art.categoryid'; $result = $GLOBALS['xoopsDB']->query($sql); - $cat_cbox_options = []; + $catCboxOptions = []; - while (list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "$cat_title ($art_count)"; + while (list($cid, $pid, $catTitle, $articleCount) = $GLOBALS['xoopsDB']->fetchRow($result)) { + $catTitle = $myts->displayTarea($catTitle); + $catCboxOptions[$cid] = "$catTitle ($articleCount)"; } - $cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); - $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); - $form->addElement($cat_label); + $catLabel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $catCboxOptions)); + $catLabel->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); + $form->addElement($catLabel); // Publisher parent category $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix($helper->getModule()->dirname() . '_categories'), 'categoryid', 'parentid'); @@ -92,19 +92,19 @@ } } - Publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); + Utility::closeCollapsableBar('newsimport', 'newsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - /* @var XoopsModuleHandler $moduleHandler */ + Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('smartsection'); $smartsection_module_id = $moduleObj->getVar('mid'); - /* @var XoopsGroupPermHandler $grouppermHandler */ + /** @var XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); $cnt_imported_cat = 0; @@ -124,7 +124,7 @@ $newCat = []; $newCat['oldid'] = $arrCat['categoryid']; $newCat['oldpid'] = $arrCat['parentid']; - /* @var Publisher\Category $categoryObj */ + /** @var Publisher\Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); $categoryObj->setVars($arrCat); @@ -180,7 +180,7 @@ // Linkes files $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_files') . ' WHERE itemid=' . $arrArticle['itemid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); - $allowed_mimetypes = null; + $allowedMimetypes = null; while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles))) { $filename = $GLOBALS['xoops']->path('uploads/smartsection/' . $arrFile['filename']); if (file_exists($filename)) { @@ -190,7 +190,7 @@ $fileObj->setVars($arrFile); $fileObj->setVar('fileid', 0); - if ($fileObj->store($allowed_mimetypes, true, false)) { + if ($fileObj->store($allowedMimetypes, true, false)) { echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filename']) . '
'; } } @@ -204,9 +204,9 @@ // Saving category permissions $groupsIds = $grouppermHandler->getGroupIds('category_read', $arrCat['categoryid'], $smartsection_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $grouppermHandler->getGroupIds('item_submit', $arrCat['categoryid'], $smartsection_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -255,6 +255,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - Publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/wfsection.php b/admin/import/wfsection.php index 69b55f67..9107ef9f 100644 --- a/admin/import/wfsection.php +++ b/admin/import/wfsection.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,6 +23,7 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -37,9 +37,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('wfsectionimport', 'wfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('wfsectionimport', 'wfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_category')); [$totalCat] = $GLOBALS['xoopsDB']->fetchRow($result); @@ -63,14 +63,14 @@ $sql = 'SELECT cat.id, cat.pid, cat.title, COUNT(art.articleid) FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_category') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('wfs_article') . ' AS art ON cat.id=art.categoryid GROUP BY art.categoryid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_values = []; - $cat_cbox_options = []; - while (list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "$cat_title ($art_count)"; + $catCboxOptions = []; + while (list($cid, $pid, $catTitle, $articleCount) = $GLOBALS['xoopsDB']->fetchRow($result)) { + $catTitle = $myts->displayTarea($catTitle); + $catCboxOptions[$cid] = "$catTitle ($articleCount)"; } - $cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); - $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); - $form->addElement($cat_label); + $catLabel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $catCboxOptions)); + $catLabel->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); + $form->addElement($catLabel); // SmartFAQ parent category $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix($helper->getModule()->dirname() . '_categories'), 'categoryid', 'parentid'); @@ -91,14 +91,14 @@ } } - Publisher\Utility::closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); + Utility::closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + Utility::openCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -116,7 +116,7 @@ $newCatArray = []; while (false !== ($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat))) { - /* @var Publisher\Category $categoryObj */ + /** @var Publisher\Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); $newCat = []; @@ -148,8 +148,8 @@ $newCat['newid'] = $categoryObj->categoryid(); // Saving category permissions - Publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); - Publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); ++$cnt_imported_cat; @@ -195,7 +195,7 @@ $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_files') . ' WHERE articleid=' . $arrArticle['articleid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); - $allowed_mimetypes = ''; + $allowedMimetypes = ''; while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles))) { $filename = $GLOBALS['xoops']->path('modules/wfsection/cache/uploaded/' . $arrFile['filerealname']); if (file_exists($filename)) { @@ -212,7 +212,7 @@ $fileObj->setVar('counter', $arrFile['counter']); $fileObj->setVar('filename', $arrFile['filerealname']); - if ($fileObj->store($allowed_mimetypes, true, false)) { + if ($fileObj->store($allowedMimetypes, true, false)) { echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } @@ -244,7 +244,7 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; - /* @var XoopsModuleHandler $moduleHandler */ + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('wfsection'); $news_module_id = $moduleObj->getVar('mid'); @@ -273,6 +273,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - Publisher\Utility::closeCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon'); + Utility::closeCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/xfsection.php b/admin/import/xfsection.php index 8cbf90ae..082d961c 100644 --- a/admin/import/xfsection.php +++ b/admin/import/xfsection.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,6 +23,7 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -37,9 +37,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('xfsectionimport', 'xfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('xfsectionimport', 'xfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_category')); [$totalCat] = $GLOBALS['xoopsDB']->fetchRow($result); @@ -63,14 +63,14 @@ $sql = 'SELECT cat.id, cat.pid, cat.title, COUNT(art.articleid) FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_category') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('xfs_article') . ' AS art ON cat.id=art.categoryid GROUP BY art.categoryid'; $result = $GLOBALS['xoopsDB']->query($sql); $cat_cbox_values = []; - $cat_cbox_options = []; - while (list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "$cat_title ($art_count)"; + $catCboxOptions = []; + while (list($cid, $pid, $catTitle, $articleCount) = $GLOBALS['xoopsDB']->fetchRow($result)) { + $catTitle = $myts->displayTarea($catTitle); + $catCboxOptions[$cid] = "$catTitle ($articleCount)"; } - $cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); - $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); - $form->addElement($cat_label); + $catLabel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $catCboxOptions)); + $catLabel->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); + $form->addElement($catLabel); // SmartFAQ parent category $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix($helper->getModule()->dirname() . '_categories'), 'categoryid', 'parentid'); @@ -91,14 +91,14 @@ } } - Publisher\Utility::closeCollapsableBar('xfsectionimport', 'xfsectionimporticon'); + Utility::closeCollapsableBar('xfsectionimport', 'xfsectionimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + Utility::openCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -111,7 +111,7 @@ $newCatArray = []; while (false !== ($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat))) { - /* @var Publisher\Category $categoryObj */ + /** @var Publisher\Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); $newCat = []; @@ -141,8 +141,8 @@ $newCat['newid'] = $categoryObj->categoryid(); // Saving category permissions - Publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); - Publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); ++$cnt_imported_cat; @@ -194,7 +194,7 @@ $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_files') . ' WHERE articleid=' . $arrArticle['articleid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); - $allowed_mimetypes = ''; + $allowedMimetypes = ''; while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles))) { $filename = $GLOBALS['xoops']->path('modules/xfsection/cache/uploaded/' . $arrFile['filerealname']); if (file_exists($filename)) { @@ -211,7 +211,7 @@ $fileObj->setVar('counter', $arrFile['counter']); $fileObj->setVar('filename', $arrFile['filerealname']); - if ($fileObj->store($allowed_mimetypes, true, false)) { + if ($fileObj->store($allowedMimetypes, true, false)) { echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } @@ -243,7 +243,7 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; - /* @var XoopsModuleHandler $moduleHandler */ + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('xfsection'); $news_module_id = $moduleObj->getVar('mid'); @@ -272,6 +272,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - Publisher\Utility::closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); + Utility::closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/xnews.php b/admin/import/xnews.php index f0919537..30df0367 100644 --- a/admin/import/xnews.php +++ b/admin/import/xnews.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,6 +23,7 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -37,9 +37,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - Publisher\Utility::openCollapsableBar('xnewsimport', 'xnewsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + Utility::openCollapsableBar('xnewsimport', 'xnewsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('nw_topics')); [$totalCat] = $GLOBALS['xoopsDB']->fetchRow($result); @@ -81,7 +81,7 @@ try { $imageCategoryHandler->insert($imagecategory); - } catch (\Exception $e) { + } catch (\Throwable $e) { echo "Caught exception: : couldn't insert Image Category " . $e->getMessage() . 'n'; } @@ -90,7 +90,7 @@ if (!isset($readgroup)) { $readgroup = []; } - if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) { + if (!in_array(XOOPS_GROUP_ADMIN, $readgroup, true)) { $readgroup[] = XOOPS_GROUP_ADMIN; } foreach ($readgroup as $rgroup) { @@ -107,7 +107,7 @@ if (!isset($writegroup)) { $writegroup = []; } - if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) { + if (!in_array(XOOPS_GROUP_ADMIN, $writegroup, true)) { $writegroup[] = XOOPS_GROUP_ADMIN; } foreach ($writegroup as $wgroup) { @@ -127,16 +127,16 @@ $sql = 'SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM ' . $GLOBALS['xoopsDB']->prefix('nw_topics') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('nw_stories') . ' AS art ON cat.topic_id=art.topicid GROUP BY art.topicid'; $result = $GLOBALS['xoopsDB']->query($sql); - $cat_cbox_options = []; + $catCboxOptions = []; - while (list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) { - $cat_title = $myts->displayTarea($cat_title); - $cat_cbox_options[$cid] = "$cat_title ($art_count)"; + while (list($cid, $pid, $catTitle, $articleCount) = $GLOBALS['xoopsDB']->fetchRow($result)) { + $catTitle = $myts->displayTarea($catTitle); + $catCboxOptions[$cid] = "$catTitle ($articleCount)"; } - $cat_label = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $cat_cbox_options)); - $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); - $form->addElement($cat_label); + $catLabel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('
', $catCboxOptions)); + $catLabel->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); + $form->addElement($catLabel); // Publisher parent category $mytree = new \XoopsTree($GLOBALS['xoopsDB']->prefix($helper->getModule()->dirname() . '_categories'), 'categoryid', 'parentid'); @@ -157,20 +157,20 @@ } } - Publisher\Utility::closeCollapsableBar('xnewsimport', 'xnewsimporticon'); + Utility::closeCollapsableBar('xnewsimport', 'xnewsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); // require_once dirname(dirname(__DIR__)) . '/include/common.php'; - Publisher\Utility::openCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - /* @var XoopsModuleHandler $moduleHandler */ + Utility::openCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + /** @var XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('xnews'); $xnews_module_id = $moduleObj->getVar('mid'); - /* @var XoopsGroupPermHandler $grouppermHandler */ + /** @var XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); $cnt_imported_cat = 0; @@ -184,7 +184,7 @@ $newCatArray = []; $newArticleArray = []; - /* @var XoopsImagecategoryHandler $imageCategoryHandler */ + /** @var XoopsImagecategoryHandler $imageCategoryHandler */ $imageCategoryHandler = xoops_getHandler('imagecategory'); // $criteria = new \CriteriaCombo; @@ -219,7 +219,7 @@ $newCat['oldid'] = $arrCat['topic_id']; $newCat['oldpid'] = $arrCat['topic_pid']; - /* @var Publisher\Category $categoryObj */ + /** @var Publisher\Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); $categoryObj->setVar('parentid', $arrCat['topic_pid']); @@ -241,13 +241,13 @@ $imageHandler = xoops_getHandler('image'); $image = $imageHandler->create(); $image->setVar('image_name', $arrCat['topic_imgurl']);//'images/' . $uploader->getSavedFileName()); - $image->setVar('image_nicename', mb_substr($arrCat['topic_imgurl'],-13)); //$image_nicename); + $image->setVar('image_nicename', mb_substr($arrCat['topic_imgurl'],-13)); //$imageNiceName); $image->setVar('image_mimetype', 'image/'. mb_substr($arrCat['topic_imgurl'],-3));//$uploader->getMediaType()); // $image->setVar('image_created', time()); // $image_display = empty($image_display) ? 0 : 1; $image->setVar('image_display', 1); //$image_display); $image->setVar('image_weight', 0);//$image_weight); - $image->setVar('imgcat_id', $newid );//$imgcat_id); + $image->setVar('imgcat_id', $newid );//$imgcatId); if (!$imageHandler->insert($image)) { $err[] = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename')); } @@ -265,7 +265,7 @@ //copy all images to Image Manager $src = $GLOBALS['xoops']->path('uploads/xnews/topics/'); $dst = $GLOBALS['xoops']->path('uploads'); - Publisher\Utility::recurseCopy($src, $dst); + Utility::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) @@ -352,12 +352,12 @@ // Linkes files $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('nw_stories_files') . ' WHERE storyid=' . $arrArticle['storyid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); - $allowed_mimetypes = ''; + $allowedMimetypes = ''; while (false !== ($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles))) { $filename = $GLOBALS['xoops']->path('uploads/xnews/attached/' . $arrFile['downloadname']); if (file_exists($filename)) { if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) { - /* @var Publisher\File $fileObj */ + /** @var Publisher\File $fileObj */ $fileObj = $helper->getHandler('File')->create(); $fileObj->setVar('name', $arrFile['filerealname']); $fileObj->setVar('description', $arrFile['filerealname']); @@ -370,7 +370,7 @@ $fileObj->setVar('filename', $arrFile['filerealname']); $fileObj->setVar('short_url', $arrFile['filerealname']); - if ($fileObj->store($allowed_mimetypes, true, false)) { + if ($fileObj->store($allowedMimetypes, true, false)) { echo '    ' . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . '
'; } } @@ -386,12 +386,12 @@ // Saving category permissions $groupsIds = $grouppermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $xnews_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $grouppermHandler->getGroupIds('nw_submit', $arrCat['topic_id'], $xnews_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $groupsIds = $grouppermHandler->getGroupIds('nw_approve', $arrCat['topic_id'], $xnews_module_id); - Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); + Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -418,12 +418,12 @@ $publisher_module_id = $helper->getModule()->mid(); - /* @var XoopsCommentHandler $commentHandler */ + /** @var XoopsCommentHandler $commentHandler */ $commentHandler = xoops_getHandler('comment'); $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('com_modid', $xnews_module_id)); $comments = $commentHandler->getObjects($criteria); - /* @var XoopsComment $comment */ + /** @var XoopsComment $comment */ foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); @@ -441,6 +441,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - Publisher\Utility::closeCollapsableBar('xnewsimportgo', 'xnewsimportgoicon'); + Utility::closeCollapsableBar('xnewsimportgo', 'xnewsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/index.php b/admin/index.php index 258c95d1..028013e8 100644 --- a/admin/index.php +++ b/admin/index.php @@ -16,28 +16,30 @@ * * @copyright The XOOPS Project (https://xoops.org) * @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/) - * @package Publisher * @since 1.0 * @author Mage, Mamba */ +use Xmf\Module\Admin; +use Xmf\Request; use Xmf\Yaml; use XoopsModules\Publisher; +use XoopsModules\Publisher\Helper; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); -/** @var \XoopsModules\Publisher\Helper $helper */ -$helper = \XoopsModules\Publisher\Helper::getInstance(); +$helper = Helper::getInstance(); $helper->loadLanguage('main'); $helper->loadLanguage('admin'); -$adminObject = \Xmf\Module\Admin::getInstance(); -$utility = new Publisher\Utility(); +$adminObject = Admin::getInstance(); +$utility = new Utility(); $configurator = new Publisher\Common\Configurator(); /* foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - Publisher\Utility::createFolder($uploadFolders[$i]); + Utility::createFolder($uploadFolders[$i]); $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder'); // $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); } @@ -46,7 +48,7 @@ $file = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; foreach (array_keys($copyFiles) as $i) { $dest = $copyFiles[$i] . '/blank.png'; - Publisher\Utility::copyFile($file, $dest); + Utility::copyFile($file, $dest); } */ @@ -106,7 +108,7 @@ if (1 == $displaySampleButton) { xoops_loadLanguage('admin/modulesadmin', 'system'); - require dirname(__DIR__) . '/testdata/index.php'; + require dirname(__DIR__) . '/testdata/index.php'; $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), './../testdata/index.php?op=load', 'add'); $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), './../testdata/index.php?op=save', 'add'); @@ -153,7 +155,7 @@ function showButtons($yamlFile) redirect_header('index.php', 0, ''); } -$op = \Xmf\Request::getString('op', 0, 'GET'); +$op = Request::getString('op', 0, 'GET'); switch ($op) { case 'hide_buttons': diff --git a/admin/item.php b/admin/item.php index e8fad2af..ac2e1b83 100644 --- a/admin/item.php +++ b/admin/item.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Admin - * @subpackage Action * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,6 +22,8 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Helper; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; @@ -32,8 +32,8 @@ redirect_header('item.php', 2, _CO_PUBLISHER_BAD_TOKEN); } -$itemid = Request::getInt('itemid', Request::getInt('itemid', 0, 'POST'), 'GET'); -$op = ($itemid > 0 || Request::getString('editor', '', 'POST')) ? 'mod' : ''; +$itemId = Request::getInt('itemid', Request::getInt('itemid', 0, 'POST'), 'GET'); +$op = ($itemId > 0 || Request::getString('editor', '', 'POST')) ? 'mod' : ''; //$op = Request::getString('op', $op, 'GET'); $op = Request::getString('op', Request::getString('op', $op, 'POST'), 'GET'); @@ -49,83 +49,83 @@ switch ($op) { case 'clone': - if (0 == $itemid) { + if (0 == $itemId) { $totalcategories = $helper->getHandler('Category')->getCategoriesCount(-1); if (0 == $totalcategories) { redirect_header('category.php?op=mod', 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM); } } - Publisher\Utility::cpHeader(); - publisher_editItem(true, $itemid, true); + Utility::cpHeader(); + publisher_editItem(true, $itemId, true); break; case 'mod': - if (0 == $itemid) { + if (0 == $itemId) { $totalcategories = $helper->getHandler('Category')->getCategoriesCount(-1); if (0 == $totalcategories) { redirect_header('category.php?op=mod', 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM); } } - Publisher\Utility::cpHeader(); - publisher_editItem(true, $itemid); + Utility::cpHeader(); + publisher_editItem(true, $itemId); break; case 'additem': - $redirect_msg = $error_msg = ''; + $redirectMsg = $errorMsg = ''; // Creating the item object /** @var Publisher\Item $itemObj */ - if (0 != $itemid) { - $itemObj = $helper->getHandler('Item')->get($itemid); + if (0 != $itemId) { + $itemObj = $helper->getHandler('Item')->get($itemId); } else { $itemObj = $helper->getHandler('Item')->create(); } $itemObj->setVarsFromRequest(); - $old_status = $itemObj->status(); + $oldStatus = $itemObj->status(); $newStatus = Request::getInt('status', Constants::PUBLISHER_STATUS_PUBLISHED); //_PUBLISHER_STATUS_NOTSET; switch ($newStatus) { case Constants::PUBLISHER_STATUS_SUBMITTED: - $error_msg = _AM_PUBLISHER_ITEMNOTCREATED; - if (Constants::PUBLISHER_STATUS_NOTSET == $old_status) { - $error_msg = _AM_PUBLISHER_ITEMNOTUPDATED; + $errorMsg = _AM_PUBLISHER_ITEMNOTCREATED; + if (Constants::PUBLISHER_STATUS_NOTSET == $oldStatus) { + $errorMsg = _AM_PUBLISHER_ITEMNOTUPDATED; } - $redirect_msg = _AM_PUBLISHER_ITEM_RECEIVED_NEED_APPROVAL; + $redirectMsg = _AM_PUBLISHER_ITEM_RECEIVED_NEED_APPROVAL; break; case Constants::PUBLISHER_STATUS_PUBLISHED: - if ((Constants::PUBLISHER_STATUS_NOTSET == $old_status) || (Constants::PUBLISHER_STATUS_SUBMITTED == $old_status)) { - $redirect_msg = _AM_PUBLISHER_SUBMITTED_APPROVE_SUCCESS; + if ((Constants::PUBLISHER_STATUS_NOTSET == $oldStatus) || (Constants::PUBLISHER_STATUS_SUBMITTED == $oldStatus)) { + $redirectMsg = _AM_PUBLISHER_SUBMITTED_APPROVE_SUCCESS; $notifToDo = [Constants::PUBLISHER_NOTIFY_ITEM_PUBLISHED]; } else { - $redirect_msg = _AM_PUBLISHER_PUBLISHED_MOD_SUCCESS; + $redirectMsg = _AM_PUBLISHER_PUBLISHED_MOD_SUCCESS; } - $error_msg = _AM_PUBLISHER_ITEMNOTUPDATED; + $errorMsg = _AM_PUBLISHER_ITEMNOTUPDATED; break; case Constants::PUBLISHER_STATUS_OFFLINE: - $redirect_msg = _AM_PUBLISHER_OFFLINE_MOD_SUCCESS; - if (Constants::PUBLISHER_STATUS_NOTSET == $old_status) { - $redirect_msg = _AM_PUBLISHER_OFFLINE_CREATED_SUCCESS; + $redirectMsg = _AM_PUBLISHER_OFFLINE_MOD_SUCCESS; + if (Constants::PUBLISHER_STATUS_NOTSET == $oldStatus) { + $redirectMsg = _AM_PUBLISHER_OFFLINE_CREATED_SUCCESS; } - $error_msg = _AM_PUBLISHER_ITEMNOTUPDATED; + $errorMsg = _AM_PUBLISHER_ITEMNOTUPDATED; break; case Constants::PUBLISHER_STATUS_REJECTED: - $error_msg = _AM_PUBLISHER_ITEMNOTCREATED; - if (Constants::PUBLISHER_STATUS_NOTSET == $old_status) { - $error_msg = _AM_PUBLISHER_ITEMNOTUPDATED; + $errorMsg = _AM_PUBLISHER_ITEMNOTCREATED; + if (Constants::PUBLISHER_STATUS_NOTSET == $oldStatus) { + $errorMsg = _AM_PUBLISHER_ITEMNOTUPDATED; } - $redirect_msg = _AM_PUBLISHER_ITEM_REJECTED; + $redirectMsg = _AM_PUBLISHER_ITEM_REJECTED; break; } $itemObj->setVar('status', $newStatus); // Storing the item if (!$itemObj->store()) { - redirect_header('', 3, $error_msg . Publisher\Utility::formatErrors($itemObj->getErrors())); + redirect_header('', 3, $errorMsg . Utility::formatErrors($itemObj->getErrors())); } // attach file if any if (($item_upload_file = Request::getArray('item_upload_file', '', 'FILES')) && '' !== $item_upload_file['name']) { - $file_upload_result = Publisher\Utility::uploadFile(false, false, $itemObj); + $file_upload_result = Utility::uploadFile(false, false, $itemObj); if (true !== $file_upload_result) { redirect_header('', 3, $file_upload_result); } @@ -136,16 +136,16 @@ $itemObj->sendNotifications($notifToDo); } - redirect_header('item.php', 2, $redirect_msg); + redirect_header('item.php', 2, $redirectMsg); break; case 'del': - $itemObj = $helper->getHandler('Item')->get($itemid); + $itemObj = $helper->getHandler('Item')->get($itemId); $confirm = Request::getInt('confirm', 0, 'POST'); if ($confirm) { if (!$helper->getHandler('Item')->delete($itemObj)) { - redirect_header('item.php', 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . Publisher\Utility::formatErrors($itemObj->getErrors())); + redirect_header('item.php', 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . Utility::formatErrors($itemObj->getErrors())); } redirect_header('item.php', 2, sprintf(_AM_PUBLISHER_ITEMISDELETED, $itemObj->getTitle())); } else { @@ -157,7 +157,7 @@ break; case 'default': default: - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); xoops_load('XoopsPageNav'); @@ -170,7 +170,7 @@ $ascOrDesc = 'DESC'; // Display Submited articles - Publisher\Utility::openCollapsableBar('submiteditemstable', 'submiteditemsicon', _AM_PUBLISHER_SUBMISSIONSMNGMT, _AM_PUBLISHER_SUBMITTED_EXP); + Utility::openCollapsableBar('submiteditemstable', 'submiteditemsicon', _AM_PUBLISHER_SUBMISSIONSMNGMT, _AM_PUBLISHER_SUBMITTED_EXP); // Get the total number of submitted ITEM $totalitems = $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]); @@ -209,7 +209,7 @@ echo ''; } } else { - $itemid = 0; + $itemId = 0; echo ''; echo "" . _AM_PUBLISHER_NOITEMS_SUBMITTED . ''; echo ''; @@ -220,10 +220,10 @@ $pagenav = new \XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $submittedstartitem, 'submittedstartitem'); echo '
' . $pagenav->renderNav() . '
'; - Publisher\Utility::closeCollapsableBar('submiteditemstable', 'submiteditemsicon'); + Utility::closeCollapsableBar('submiteditemstable', 'submiteditemsicon'); // Display Published articles - Publisher\Utility::openCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon', _AM_PUBLISHER_PUBLISHEDITEMS, _AM_PUBLISHER_PUBLISHED_DSC); + Utility::openCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon', _AM_PUBLISHER_PUBLISHEDITEMS, _AM_PUBLISHER_PUBLISHED_DSC); // Get the total number of published ITEM $totalitems = $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_PUBLISHED]); @@ -263,7 +263,7 @@ echo ''; } } else { - $itemid = 0; + $itemId = 0; echo ''; echo "" . _AM_PUBLISHER_NOITEMS . ''; echo ''; @@ -274,10 +274,10 @@ $pagenav = new \XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $publishedstartitem, 'publishedstartitem'); echo '
' . $pagenav->renderNav() . '
'; - Publisher\Utility::closeCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon'); + Utility::closeCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon'); // Display Offline articles - Publisher\Utility::openCollapsableBar('offlineitemstable', 'offlineitemsicon', _AM_PUBLISHER_ITEMS . ' ' . _CO_PUBLISHER_OFFLINE, _AM_PUBLISHER_OFFLINE_EXP); + Utility::openCollapsableBar('offlineitemstable', 'offlineitemsicon', _AM_PUBLISHER_ITEMS . ' ' . _CO_PUBLISHER_OFFLINE, _AM_PUBLISHER_OFFLINE_EXP); $totalitems = $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_OFFLINE]); @@ -317,7 +317,7 @@ echo ''; } } else { - $itemid = 0; + $itemId = 0; echo ''; echo "" . _AM_PUBLISHER_NOITEMS_OFFLINE . ''; echo ''; @@ -328,10 +328,10 @@ $pagenav = new \XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $offlinestartitem, 'offlinestartitem'); echo '
' . $pagenav->renderNav() . '
'; - Publisher\Utility::closeCollapsableBar('offlineitemstable', 'offlineitemsicon'); + Utility::closeCollapsableBar('offlineitemstable', 'offlineitemsicon'); // Display Rejected articles - Publisher\Utility::openCollapsableBar('Rejecteditemstable', 'rejecteditemsicon', _AM_PUBLISHER_REJECTED_ITEM, _AM_PUBLISHER_REJECTED_ITEM_EXP, _AM_PUBLISHER_SUBMITTED_EXP); + Utility::openCollapsableBar('Rejecteditemstable', 'rejecteditemsicon', _AM_PUBLISHER_REJECTED_ITEM, _AM_PUBLISHER_REJECTED_ITEM_EXP, _AM_PUBLISHER_SUBMITTED_EXP); // Get the total number of Rejected ITEM $totalitems = $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_REJECTED]); @@ -369,7 +369,7 @@ echo ''; } } else { - $itemid = 0; + $itemId = 0; echo ''; echo "" . _AM_PUBLISHER_NOITEMS_REJECTED . ''; echo ''; @@ -380,20 +380,19 @@ $pagenav = new \XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $rejectedstartitem, 'rejectedstartitem'); echo '
' . $pagenav->renderNav() . '
'; - Publisher\Utility::closeCollapsableBar('Rejecteditemstable', 'rejecteditemsicon'); + Utility::closeCollapsableBar('Rejecteditemstable', 'rejecteditemsicon'); break; } require_once __DIR__ . '/admin_footer.php'; /** * @param bool $showmenu - * @param int $itemid + * @param int $itemId * @param bool $clone */ -function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) +function publisher_editItem($showmenu = false, $itemId = 0, $clone = false) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); global $publisherCurrentPage; xoops_load('XoopsFormLoader'); @@ -403,10 +402,10 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) // if there is a parameter, and the id exists, retrieve data: we're editing a item - if (0 !== $itemid) { + if (0 !== $itemId) { // Creating the ITEM object /** @var \XoopsModules\Publisher\Item $itemObj */ - $itemObj = $helper->getHandler('Item')->get($itemid); + $itemObj = $helper->getHandler('Item')->get($itemId); if (null === $itemObj) { redirect_header('item.php', 1, _AM_PUBLISHER_NOITEMSELECTED); @@ -474,7 +473,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $categoryObj = $itemObj->getCategory(); echo "
\n"; - Publisher\Utility::openCollapsableBar('edititemtable', 'edititemicon', $pageTitle, $pageInfo); + Utility::openCollapsableBar('edititemtable', 'edititemicon', $pageTitle, $pageInfo); if ($clone) { echo '
'; @@ -495,7 +494,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $categoryObj->setVar('categoryid', Request::getInt('categoryid', 0, 'GET')); - Publisher\Utility::openCollapsableBar('createitemtable', 'createitemicon', _AM_PUBLISHER_ITEM_CREATING, _AM_PUBLISHER_ITEM_CREATING_DSC); + Utility::openCollapsableBar('createitemtable', 'createitemicon', _AM_PUBLISHER_ITEM_CREATING, _AM_PUBLISHER_ITEM_CREATING_DSC); } $sform = $itemObj->getForm(_AM_PUBLISHER_ITEMS); @@ -503,11 +502,11 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $sform->assign($formTpl); $formTpl->display('db:publisher_submit.tpl'); - Publisher\Utility::closeCollapsableBar('edititemtable', 'edititemicon'); + Utility::closeCollapsableBar('edititemtable', 'edititemicon'); - Publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); + Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); - $dir = Publisher\Utility::getUploadDir(true, 'content'); + $dir = Utility::getUploadDir(true, 'content'); if (!is_writable($dir)) { echo "

" . _AM_PUBLISHER_PERMERROR . '

'; @@ -526,7 +525,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) // Delete File $form = new \XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php'); - $pWrapSelect = new \XoopsFormSelect(Publisher\Utility::getUploadDir(true, 'content'), 'address'); + $pWrapSelect = new \XoopsFormSelect(Utility::getUploadDir(true, 'content'), 'address'); $folder = dir($dir); while (false !== ($file = $folder->read())) { if ('.' !== $file && '..' !== $file) { @@ -544,5 +543,5 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $form->addElement(new \XoopsFormHidden('backto', $publisherCurrentPage)); $form->display(); - Publisher\Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); + Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); } diff --git a/admin/main.php b/admin/main.php index 1d33f238..c034d320 100644 --- a/admin/main.php +++ b/admin/main.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -23,6 +22,7 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; require_once $GLOBALS['xoops']->path('class/xoopslists.php'); @@ -30,15 +30,15 @@ // require_once dirname(__DIR__) . '/class/Utility.php'; require_once dirname(__DIR__) . '/include/common.php'; -$itemid = Request::getInt('itemid', 0, 'POST'); +$itemId = Request::getInt('itemid', 0, 'POST'); $pick = Request::getInt('pick', Request::getInt('pick', 0, 'GET'), 'POST'); $statussel = Request::getInt('statussel', Request::getInt('statussel', 0, 'GET'), 'POST'); $sortsel = Request::getString('sortsel', Request::getString('sortsel', 'itemid', 'GET'), 'POST'); $ordersel = Request::getString('ordersel', Request::getString('ordersel', 'DESC', 'GET'), 'POST'); -$module_id = $helper->getModule()->mid(); -/* @var XoopsGroupPermHandler $grouppermHandler */ +$moduleId = $helper->getModule()->mid(); +/** @var XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; @@ -46,7 +46,7 @@ $startentry = Request::getInt('startentry', 0, 'GET'); -Publisher\Utility::cpHeader(); +Utility::cpHeader(); //publisher_adminMenu(0, _AM_PUBLISHER_INDEX); // Total ITEMs -- includes everything on the table @@ -68,15 +68,15 @@ $totalrejected = $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_REJECTED]); // Check Path Configuration -if ((Publisher\Utility::getPathStatus('root', true) < 0) - || (Publisher\Utility::getPathStatus('images', true) < 0) - || (Publisher\Utility::getPathStatus('images/category', true) < 0) - || (Publisher\Utility::getPathStatus('images/item', true) < 0) - || (Publisher\Utility::getPathStatus('content', true) < 0)) { - Publisher\Utility::createDir(); +if ((Utility::getPathStatus('root', true) < 0) + || (Utility::getPathStatus('images', true) < 0) + || (Utility::getPathStatus('images/category', true) < 0) + || (Utility::getPathStatus('images/item', true) < 0) + || (Utility::getPathStatus('content', true) < 0)) { + Utility::createDir(); } -Publisher\Utility::openCollapsableBar('inventorytable', 'inventoryicon', _AM_PUBLISHER_INVENTORY); +Utility::openCollapsableBar('inventorytable', 'inventoryicon', _AM_PUBLISHER_INVENTORY); echo '
'; echo ""; echo "'; @@ -91,10 +91,10 @@ echo "  "; echo ''; -Publisher\Utility::closeCollapsableBar('inventorytable', 'inventoryicon'); +Utility::closeCollapsableBar('inventorytable', 'inventoryicon'); // Construction of lower table -Publisher\Utility::openCollapsableBar('allitemstable', 'allitemsicon', _AM_PUBLISHER_ALLITEMS, _AM_PUBLISHER_ALLITEMSMSG); +Utility::openCollapsableBar('allitemstable', 'allitemsicon', _AM_PUBLISHER_ALLITEMS, _AM_PUBLISHER_ALLITEMSMSG); $showingtxt = ''; $selectedtxt = ''; @@ -159,31 +159,31 @@ $selectedtxt0 = 'selected'; $caption = _AM_PUBLISHER_ALL; $cond = ''; - $status_explaination = _AM_PUBLISHER_ALL_EXP; + $statusExplanation = _AM_PUBLISHER_ALL_EXP; break; case Constants::PUBLISHER_STATUS_SUBMITTED: $selectedtxt1 = 'selected'; $caption = _CO_PUBLISHER_SUBMITTED; $cond = ' WHERE status = ' . Constants::PUBLISHER_STATUS_SUBMITTED . ' '; - $status_explaination = _AM_PUBLISHER_SUBMITTED_EXP; + $statusExplanation = _AM_PUBLISHER_SUBMITTED_EXP; break; case Constants::PUBLISHER_STATUS_PUBLISHED: $selectedtxt2 = 'selected'; $caption = _CO_PUBLISHER_PUBLISHED; $cond = ' WHERE status = ' . Constants::PUBLISHER_STATUS_PUBLISHED . ' '; - $status_explaination = _AM_PUBLISHER_PUBLISHED_EXP; + $statusExplanation = _AM_PUBLISHER_PUBLISHED_EXP; break; case Constants::PUBLISHER_STATUS_OFFLINE: $selectedtxt3 = 'selected'; $caption = _CO_PUBLISHER_OFFLINE; $cond = ' WHERE status = ' . Constants::PUBLISHER_STATUS_OFFLINE . ' '; - $status_explaination = _AM_PUBLISHER_OFFLINE_EXP; + $statusExplanation = _AM_PUBLISHER_OFFLINE_EXP; break; case Constants::PUBLISHER_STATUS_REJECTED: $selectedtxt4 = 'selected'; $caption = _CO_PUBLISHER_REJECTED; $cond = ' WHERE status = ' . Constants::PUBLISHER_STATUS_REJECTED . ' '; - $status_explaination = _AM_PUBLISHER_REJECTED_ITEM_EXP; + $statusExplanation = _AM_PUBLISHER_REJECTED_ITEM_EXP; break; } @@ -234,7 +234,7 @@ $totalItemsOnPage = count($itemsObj); -Publisher\Utility::buildTableItemTitleRow(); +Utility::buildTableItemTitleRow(); if ($numrows > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { @@ -315,7 +315,7 @@ echo ''; } echo "
" . _AM_PUBLISHER_TOTALCAT . "" . $totalcategories . '
\n"; -echo "$status_explaination"; +echo "$statusExplanation"; $pagenav = new \XoopsPageNav($numrows, $helper->getConfig('idxcat_perpage'), $startentry, 'startentry', "statussel=$statussel&sortsel=$sortsel&ordersel=$ordersel"); if (1 == $helper->getConfig('format_image_nav')) { @@ -324,7 +324,7 @@ echo '
' . $pagenav->renderNav() . '
'; } // ENDs code to show active entries -Publisher\Utility::closeCollapsableBar('allitemstable', 'allitemsicon'); +Utility::closeCollapsableBar('allitemstable', 'allitemsicon'); // Close the collapsable div require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/menu.php b/admin/menu.php index 3cf9bfc6..5f0703aa 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -22,13 +21,11 @@ use XoopsModules\Publisher; - require_once dirname(__DIR__) . '/preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -/** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); $helper->loadLanguage('common'); $helper->loadLanguage('feedback'); @@ -63,6 +60,15 @@ 'link' => 'admin/item.php', 'icon' => $pathIcon32 . '/content.png', ]; + +// Trello +$adminmenu[] = [ + 'title' => _MI_PUBLISHER_ADMENU7, + 'link' => 'admin/trello.php', + 'icon' => $pathIcon32 . '/extention.png', +]; + + // Permissions $adminmenu[] = [ 'title' => _MI_PUBLISHER_ADMENU4, diff --git a/admin/migrate.php b/admin/migrate.php index e62ee881..f6d2d209 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -55,13 +55,11 @@ //XoopsLoad::load('migrate', 'newbb'); -/** @var Publisher\Common\Configurator $configurator */ $configurator = new Publisher\Common\Configurator(); -/** @var \XoopsModules\Publisher\Common\Migrate $migrator */ -$migrator = new \XoopsModules\Publisher\Common\Migrate($configurator); +$migrator = new \XoopsModules\Publisher\Common\Migrate($configurator = null); -$op = Request::getCmd('op', 'default'); +$op = Request::getCmd('op', 'show'); $opShow = Request::getCmd('show', null, 'POST'); $opMigrate = Request::getCmd('migrate', null, 'POST'); $opSchema = Request::getCmd('schema', null, 'POST'); @@ -73,6 +71,7 @@ switch ($op) { case 'show': + default: $queue = $migrator->getSynchronizeDDL(); if (!empty($queue)) { echo "
\n";
@@ -84,15 +83,16 @@
         break;
     case 'migrate':
         $migrator->synchronizeSchema();
-        $message = 'Database migrated to current schema.';
+        $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK');
         break;
     case 'schema':
-        xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', 'Warning! This is intended for developers only. Confirm write schema file from current database.', 'Confirm');
+        xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'));
         break;
     case 'confirmwrite':
         if ($GLOBALS['xoopsSecurity']->check()) {
             $migrator->saveCurrentSchema();
-            $message = 'Current schema file written';
+
+            $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK');
         }
         break;
 }
diff --git a/admin/mimetypes.php b/admin/mimetypes.php
index dd742069..e3120561 100644
--- a/admin/mimetypes.php
+++ b/admin/mimetypes.php
@@ -14,8 +14,6 @@
 /**
  * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
  * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package         Admin
- * @subpackage      Action
  * @since           1.0
  * @author          trabis 
  * @author          The SmartFactory 
@@ -23,6 +21,7 @@
 
 use Xmf\Request;
 use XoopsModules\Publisher;
+use XoopsModules\Publisher\MimetypesUtility;
 
 require_once __DIR__ . '/admin_header.php';
 xoops_load('XoopsPagenav');
@@ -52,31 +51,31 @@
 
 switch ($op) {
     case 'add':
-        Publisher\MimetypesUtility::add();
+        MimetypesUtility::add();
         break;
     case 'delete':
-        Publisher\MimetypesUtility::delete();
+        MimetypesUtility::delete();
         break;
     case 'edit':
-        Publisher\MimetypesUtility::edit();
+        MimetypesUtility::edit();
         break;
     case 'search':
-        Publisher\MimetypesUtility::search();
+        MimetypesUtility::search();
         break;
     case 'updateMimeValue':
-        Publisher\MimetypesUtility::updateMimeValue();
+        MimetypesUtility::updateMimeValue();
         break;
     case 'confirmUpdateMimeValue':
-        Publisher\MimetypesUtility::confirmUpdateMimeValue();
+        MimetypesUtility::confirmUpdateMimeValue();
         break;
     case 'clearAddSession':
-        Publisher\MimetypesUtility::clearAddSession();
+        MimetypesUtility::clearAddSession();
         break;
     case 'clearEditSession':
-        Publisher\MimetypesUtility::clearEditSession();
+        MimetypesUtility::clearEditSession();
         break;
     case 'manage':
     default:
-        Publisher\MimetypesUtility::manage();
+        MimetypesUtility::manage();
         break;
 }
diff --git a/admin/pagewrap.php b/admin/pagewrap.php
index bf547e25..f3809fc7 100644
--- a/admin/pagewrap.php
+++ b/admin/pagewrap.php
@@ -14,22 +14,22 @@
 /**
  * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
  * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
- * @package         Publisher
  * @since           1.0
  * @author          trabis 
  * @author          The SmartFactory 
  */
 
 use XoopsModules\Publisher;
+use XoopsModules\Publisher\Utility;
 
 require_once __DIR__ . '/admin_header.php';
 
-Publisher\Utility::cpHeader();
+Utility::cpHeader();
 //publisher_adminMenu(-1, _AM_PUBLISHER_ITEMS . " > " . _AM_PUBLISHER_PAGEWRAP);
 
-Publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC);
+Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC);
 
-$dir = Publisher\Utility::getUploadDir(true, 'content');
+$dir = Utility::getUploadDir(true, 'content');
 
 if (false !== mb_strpos(decoct(fileperms($dir)), '777')) {
     echo "

" . _AM_PUBLISHER_PERMERROR . '

'; @@ -47,7 +47,7 @@ // Delete File $form = new \XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php'); -$pWrapSelect = new \XoopsFormSelect(Publisher\Utility::getUploadDir(true, 'content'), 'address'); +$pWrapSelect = new \XoopsFormSelect(Utility::getUploadDir(true, 'content'), 'address'); $folder = dir($dir); while ($file == $folder->read()) { if ('.' !== $file && '..' !== $file) { @@ -63,6 +63,6 @@ $form->addElement($submit); $form->display(); -Publisher\Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); +Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/permissions.php b/admin/permissions.php index c0970ce1..9d5fcd7d 100644 --- a/admin/permissions.php +++ b/admin/permissions.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -22,21 +21,21 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; require_once dirname(__DIR__) . '/include/common.php'; require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); $myts = \MyTextSanitizer::getInstance(); -Publisher\Utility::cpHeader(); +Utility::cpHeader(); //publisher_adminMenu(3, _AM_PUBLISHER_PERMISSIONS); -/** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); // View Categories permissions $item_list_view = []; $block_view = []; -Publisher\Utility::openCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS); +Utility::openCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS); $result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { @@ -48,11 +47,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -Publisher\Utility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view'); +Utility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view'); // Submit Categories permissions echo "
\n"; -Publisher\Utility::openCollapsableBar('permissionstable_submit', 'permissionsicon_submit', _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC); +Utility::openCollapsableBar('permissionstable_submit', 'permissionsicon_submit', _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC); $result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { $form_submit = new \XoopsGroupPermForm('', $helper->getModule()->mid(), 'item_submit', '', 'admin/permissions.php'); @@ -63,11 +62,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -Publisher\Utility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit'); +Utility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit'); // Moderators Categories permissions echo "
\n"; -Publisher\Utility::openCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation', _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC); +Utility::openCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation', _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC); $result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { $form_submit = new \XoopsGroupPermForm('', $helper->getModule()->mid(), 'category_moderation', '', 'admin/permissions.php'); @@ -78,11 +77,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -Publisher\Utility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation'); +Utility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation'); // Form permissions echo "
\n"; -Publisher\Utility::openCollapsableBar('permissionstable_form', 'permissionsicon_form', _AM_PUBLISHER_PERMISSIONS_FORM, _AM_PUBLISHER_PERMISSIONS_FORM_DSC); +Utility::openCollapsableBar('permissionstable_form', 'permissionsicon_form', _AM_PUBLISHER_PERMISSIONS_FORM, _AM_PUBLISHER_PERMISSIONS_FORM_DSC); $form_options = [ Constants::PUBLISHER_SUMMARY => _AM_PUBLISHER_SUMMARY, //Constants::PUBLISHER_DISPLAY_SUMMARY => _CO_PUBLISHER_DISPLAY_SUMMARY, @@ -118,23 +117,23 @@ } unset($key, $value); echo $form_submit->render(); -Publisher\Utility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form'); +Utility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form'); // Editors permissions echo "
\n"; -Publisher\Utility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC); -$editors = Publisher\Utility::getEditors(); +Utility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC); +$editors = Utility::getEditors(); $form_submit = new \XoopsGroupPermForm('', $helper->getModule()->mid(), 'editors', '', 'admin/permissions.php'); foreach ($editors as $key => $value) { $form_submit->addItem($key, $value['title']); } unset($key, $value); echo $form_submit->render(); -Publisher\Utility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors'); +Utility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors'); // Global permissions echo "
\n"; -Publisher\Utility::openCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC); +Utility::openCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC); $form_options = [ Constants::PUBLISHER_SEARCH => _AM_PUBLISHER_SEARCH, Constants::PUBLISHER_RATE => _AM_PUBLISHER_RATE, @@ -145,6 +144,6 @@ } unset($key, $value); echo $form_submit->render(); -Publisher\Utility::closeCollapsableBar('permissionstable_global', 'permissionsicon_global'); +Utility::closeCollapsableBar('permissionstable_global', 'permissionsicon_global'); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/preferences.php b/admin/preferences.php index 175ec61a..50098db9 100644 --- a/admin/preferences.php +++ b/admin/preferences.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author Kazumi Ono (AKA onokazu) @@ -22,10 +21,10 @@ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; -/** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); $module = $helper->getModule(); @@ -66,7 +65,7 @@ $xv_configs = $module->getInfo('config'); $config_cats = $module->getInfo('configcat'); - if (!array_key_exists('others', $config_cats)) { + if (is_array($config_cats) && !array_key_exists('others', $config_cats)) { $config_cats['others'] = [ 'name' => _MI_PUBLISHER_CONFCAT_OTHERS, 'description' => _MI_PUBLISHER_CONFCAT_OTHERS_DSC, @@ -86,10 +85,12 @@ xoops_load('XoopsFormLoader'); - foreach ($config_cats as $formCat => $info) { - $$formCat = new \XoopsThemeForm($info['name'], 'pref_form_' . $formCat, 'preferences.php', 'post', true); + if (is_array($config_cats)) { + foreach ($config_cats as $formCat => $info) { + $$formCat = new \XoopsThemeForm($info['name'], 'pref_form_' . $formCat, 'preferences.php', 'post', true); + } + unset($formCat, $info); } - unset($formCat, $info); for ($i = 0; $i < $count; ++$i) { foreach ($xv_configs as $xv_config) { @@ -102,7 +103,7 @@ $formCat = $xv_config['category'] ?? ''; unset($xv_config); - if (!array_key_exists($formCat, $config_cats)) { + if (is_array($config_cats) && !array_key_exists($formCat, $config_cats)) { $formCat = 'others'; $cat_others_used = true; } @@ -177,12 +178,14 @@ break; } $hidden = new \XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); - $$formCat->addElement($ele); - $$formCat->addElement($hidden); - unset($ele, $hidden); + if (isset($$formCat) && null !== $$formCat) { + $$formCat->addElement($ele); + $$formCat->addElement($hidden); + unset($ele, $hidden); + } } - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(5, _PREFERENCES); foreach ($config_cats as $formCat => $info) { if ('others' === $formCat && !$cat_others_used) { @@ -190,9 +193,9 @@ } $$formCat->addElement(new \XoopsFormHidden('op', 'save')); $$formCat->addElement(new \XoopsFormButton('', 'button', _GO, 'submit')); - Publisher\Utility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']); + Utility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']); $$formCat->display(); - Publisher\Utility::closeCollapsableBar($formCat . '_table', $formCat . '_icon'); + Utility::closeCollapsableBar($formCat . '_table', $formCat . '_icon'); } unset($formCat, $info); xoops_cp_footer(); diff --git a/admin/pw_delete_file.php b/admin/pw_delete_file.php index 2b4f500e..6deffb04 100644 --- a/admin/pw_delete_file.php +++ b/admin/pw_delete_file.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory diff --git a/admin/pw_upload_file.php b/admin/pw_upload_file.php index bad30106..a653ecc9 100644 --- a/admin/pw_upload_file.php +++ b/admin/pw_upload_file.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -22,6 +21,7 @@ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; require_once __DIR__ . '/admin_header.php'; @@ -45,7 +45,6 @@ function publisher_pagewrap_upload(&$errors) // require_once PUBLISHER_ROOT_PATH . '/class/uploader.php'; xoops_load('XoopsMediaUploader'); - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); $postField = 'fileupload'; @@ -53,13 +52,13 @@ function publisher_pagewrap_upload(&$errors) $maxImageWidth = $helper->getConfig('maximum_image_width'); $maxImageHeight = $helper->getConfig('maximum_image_height'); - if (!is_dir(Publisher\Utility::getUploadDir(true, 'content'))) { - if (!mkdir($concurrentDirectory = Publisher\Utility::getUploadDir(true, 'content'), 0757) && !is_dir($concurrentDirectory)) { + if (!is_dir(Utility::getUploadDir(true, 'content'))) { + if (!mkdir($concurrentDirectory = Utility::getUploadDir(true, 'content'), 0757) && !is_dir($concurrentDirectory)) { throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); } } $allowedMimeTypes = ['text/html', 'text/plain', 'application/xhtml+xml']; - $uploader = new \XoopsMediaUploader(Publisher\Utility::getUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight); + $uploader = new \XoopsMediaUploader(Utility::getUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight); if ($uploader->fetchMedia($postField)) { $uploader->setTargetFileName($uploader->getMediaName()); if ($uploader->upload()) { diff --git a/admin/trello.php b/admin/trello.php new file mode 100644 index 00000000..96dd9962 --- /dev/null +++ b/admin/trello.php @@ -0,0 +1,38 @@ +displayNavigation(basename(__FILE__)); + +$statusArray = [ + Constants::PUBLISHER_STATUS_SUBMITTED => \_CO_PUBLISHER_SUBMITTED, + Constants::PUBLISHER_STATUS_PUBLISHED => \_CO_PUBLISHER_PUBLISHED, + Constants::PUBLISHER_STATUS_OFFLINE => \_CO_PUBLISHER_OFFLINE, + Constants::PUBLISHER_STATUS_REJECTED => \_CO_PUBLISHER_REJECTED, +]; + +$projectName = 'StartTuts'; +$trelloManagement = new TrelloManagement(); +$statusResult = $trelloManagement->getAllStatus(); + +foreach ($statusResult as $statusRow) { +// $itemResult[] = $trelloManagement->getProjectTaskByStatus($statusRow['id'], $projectName); +// $itemResult[] = $trelloManagement->getProjectTaskByStatus($statusRow['itemid'], $statusRow['itemid']); +} + +//$xoopsTpl->assign('taskResult', $itemResult); +$xoopsTpl->assign('statusResult', $statusResult); +$xoopsTpl->assign('itemResult', $statusResult); +$xoopsTpl->assign('statusArray', $statusArray); +$xoopsTpl->assign('publisher_url', PUBLISHER_URL); + + +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/trellostatus.php b/admin/trellostatus.php new file mode 100644 index 00000000..147ec2a8 --- /dev/null +++ b/admin/trellostatus.php @@ -0,0 +1,10 @@ +editTaskStatus($statusId, $itemId); diff --git a/archive.php b/archive.php index 5c22c441..e5c5f775 100644 --- a/archive.php +++ b/archive.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author Bandit-X * @author trabis @@ -163,18 +162,18 @@ $xoopsTpl->assign('lang_actions', _MD_PUBLISHER_ACTIONS); $xoopsTpl->assign('lang_date', _MD_PUBLISHER_DATE); $xoopsTpl->assign('lang_views', _MD_PUBLISHER_HITS); - $xoopsTpl->assign('lang_category', _MD_PUBLISHER_CATEGORY); + $xoopsTpl->assign('lang_category', _MD_PUBLISHER_CATEGORY); $xoopsTpl->assign('lang_author', _MD_PUBLISHER_AUTHOR); - + // must adjust the selected time to server timestamp - $timeoffset = $useroffset - $GLOBALS['xoopsConfig']['server_TZ']; - $timeoffsethours = (int)$timeoffset; - $timeoffsetminutes = intval(($timeoffset - $timeoffsethours) * 60); + $timeoffset = $useroffset - $GLOBALS['xoopsConfig']['server_TZ']; + $timeoffsethours = (int)$timeoffset; + $timeoffsetminutes = ($timeoffset - $timeoffsethours) * 60; $monthstart = mktime(0 - $timeoffsethours, 0 - $timeoffsetminutes, 0, $frommonth, 1, $fromyear); $monthend = mktime(23 - $timeoffsethours, 59 - $timeoffsetminutes, 59, $frommonth + 1, 0, $fromyear); - $monthend = ($monthend > time()) ? time() : $monthend; + $monthend = ($monthend > time()) ? time() : $monthend; $count = 0; @@ -203,33 +202,33 @@ foreach ($storyarray as $item) { $story = []; - $htmltitle = ''; + $htmltitle = ''; $story['title'] = "' . $item->getTitle() . ''; $story['cleantitle'] = strip_tags($item->getTitle()); - $story['itemurl'] = $item->getItemUrl(); - $story['category'] = "" . $item->getCategoryName() . ''; - $story['counter'] = $item->counter(); + $story['itemurl'] = $item->getItemUrl(); + $story['category'] = "" . $item->getCategoryName() . ''; + $story['counter'] = $item->counter(); $story['date'] = $item->getDatesub(); $story['print_link'] = XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/print.php?itemid=' . $item->itemid(); $story['mail_link'] = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $item->getItemUrl(); $story['pdf_link'] = XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/makepdf.php?itemid=' . $item->itemid(); $story['author'] = $item->getWho(); - $story['summary'] = $item->getSummary(); - $story['cancomment'] = $item->cancomment(); - - $mainImage = $item->getMainImage(); - if (empty($mainImage['image_path'])) { - $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; - } - //check to see if GD function exist + $story['summary'] = $item->getSummary(); + $story['cancomment'] = $item->cancomment(); + + $mainImage = $item->getMainImage(); + if (empty($mainImage['image_path'])) { + $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; + } + //check to see if GD function exist if (!empty($mainImage['image_path']) && !function_exists('imagecreatetruecolor')) { - $story['item_image'] = $mainImage['path']; + $story['item_image'] = $mainImage['path']; } else { - $story['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; - $story['image_path'] = $mainImage['image_path']; - } - - $comments = $item->comments(); + $story['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; + $story['image_path'] = $mainImage['image_path']; + } + + $comments = $item->comments(); if ($comments > 0) { //shows 1 comment instead of 1 comm. if comments ==1 //langugage file modified accordingly @@ -239,11 +238,11 @@ $story['comment'] = ' ' . $comments . ' ' . _MD_PUBLISHER_COMMENTS . ' '; } } else { - $story['comment'] = ' ' . _MD_PUBLISHER_NO_COMMENTS . ' '; + $story['comment'] = ' ' . _MD_PUBLISHER_NO_COMMENTS . ' '; } $xoopsTpl->append('stories', $story); } - //unset($item); + //unset($item); } $xoopsTpl->assign('lang_printer', _MD_PUBLISHER_PRINTERFRIENDLY); $xoopsTpl->assign('lang_sendstory', _MD_PUBLISHER_SENDSTORY); @@ -251,7 +250,7 @@ } else { $xoopsTpl->assign('show_articles', false); } - + $xoopsTpl->assign('lang_newsarchives', _MD_PUBLISHER_ARCHIVES); require_once $GLOBALS['xoops']->path('footer.php'); diff --git a/assets/css/publisher.css b/assets/css/publisher.css index c3ab737b..08f39b85 100644 --- a/assets/css/publisher.css +++ b/assets/css/publisher.css @@ -269,7 +269,7 @@ ul.publisher_breadcrumb li { } ul.publisher_breadcrumb li+li:before { padding: 8px; - color: black; + color: #000000; content: "/\00a0"; } ul.publisher_breadcrumb li a { diff --git a/assets/css/trello.css b/assets/css/trello.css new file mode 100644 index 00000000..d01cace2 --- /dev/null +++ b/assets/css/trello.css @@ -0,0 +1,73 @@ +body { + font-family: arial; +} +.task-board { + background: #2c7cbc; + display: inline-block; + padding: 12px; + border-radius: 3px; + width: 98%; + white-space: nowrap; + overflow-x: scroll; + min-height: 300px; +} + +.status-card { + width: 250px; + margin-right: 8px; + background: #e2e4e6; + border-radius: 3px; + display: inline-block; + vertical-align: top; + font-size: 0.9em; +} + +.status-card:last-child { + margin-right: 0px; +} + +.card-header { + width: 100%; + padding: 10px 10px 0px 10px; + box-sizing: border-box; + border-radius: 3px; + display: block; + font-weight: bold; +} + +.card-header-text { + display: block; +} + +ul.sortable { + padding-bottom: 10px; +} + +ul.sortable li:last-child { + margin-bottom: 0px; +} + +ul { + list-style: none; + margin: 0; + padding: 0px; +} + +.text-row { + padding: 15px 10px; + margin: 10px; + background: #fff; + box-sizing: border-box; + border-radius: 3px; + border-bottom: 1px solid #ccc; + cursor: pointer; + font-size: 0.8em; + white-space: normal; + line-height: 20px; +} + +.ui-sortable-placeholder { + visibility: inherit !important; + background: transparent; + border: #666 2px dashed; +} diff --git a/assets/js/trello.js b/assets/js/trello.js new file mode 100644 index 00000000..85e22176 --- /dev/null +++ b/assets/js/trello.js @@ -0,0 +1,15 @@ +$( function() { + var url = 'trellostatus.php'; + $('ul[itemid^="sort"]').sortable({ + connectWith: ".sortable", + receive: function (e, ui) { + var status_id = $(ui.item).parent(".sortable").data("status-id"); + var item_id = $(ui.item).data("item-id"); + $.ajax({ + url: url+'?status='+status_id+'&itemid='+item_id, + success: function(response){ + } + }); + } + }).disableSelection(); +} ); diff --git a/author_items.php b/author_items.php index d4698f8f..44c92919 100644 --- a/author_items.php +++ b/author_items.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Action * @since 1.0 * @author trabis */ @@ -59,8 +57,8 @@ $xoopsTpl->assign('permRating', $helper->getConfig('perm_rating')); xoops_load('XoopsUserUtility'); -$author_name = \XoopsUserUtility::getUnameFromId($uid, $helper->getConfig('format_realname'), true); -$xoopsTpl->assign('author_name_with_link', $author_name); +$authorName = \XoopsUserUtility::getUnameFromId($uid, $helper->getConfig('format_realname'), true); +$xoopsTpl->assign('author_name_with_link', $authorName); $xoopsTpl->assign('user_avatarurl', XOOPS_URL . '/uploads/' . $thisuser->getVar('user_avatar')); //$xoopsLocal = new \XoopsLocal(); $categories = []; @@ -77,55 +75,53 @@ ]; } //mb start - $mainImage = $item->getMainImage(); - if (empty($mainImage['image_path'])) { + $mainImage = $item->getMainImage(); + if (empty($mainImage['image_path'])) { $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; - } + } // check to see if GD function exist if (!empty($mainImage['image_path']) && !function_exists('imagecreatetruecolor')) { $image = $mainImage['image_path']; } else { - $image = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; - } + $image = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; + } //mb end - $comments = $item->comments(); - if ($comments > 0) { - //shows 1 comment instead of 1 comm. if comments ==1 - //langugage file modified accordingly - if (1 == $comments) { - $comment = ' ' . _MB_PUBLISHER_ONECOMMENT . ' '; - } else { - $comment = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' '; - } + $comments = $item->comments(); + if ($comments > 0) { + //shows 1 comment instead of 1 comm. if comments ==1 + //langugage file modified accordingly + if (1 == $comments) { + $comment = ' ' . _MB_PUBLISHER_ONECOMMENT . ' '; } else { - $comment = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; + $comment = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' '; } - - - + } else { + $comment = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; + } + $categories[$catId]['count_items']++; $categories[$catId]['count_hits'] += $item->counter(); $categories[$catId]['items'][] = [ - 'title' => $item->getTitle(), - 'cleantitle'=> strip_tags($item->getTitle()), - 'itemurl' => $item->getItemUrl(), - 'summary' => $item->getSummary(), - 'comment' => $comment, - 'cancomment'=> $item->cancomment(), - 'hits' => $item->counter(), - 'link' => $item->getItemLink(), - 'published' => $item->getDatesub(), - //'published' => $item->getDatesub(_SHORTDATESTRING), + 'title' => $item->getTitle(), + 'cleantitle' => strip_tags($item->getTitle()), + 'itemurl' => $item->getItemUrl(), + 'summary' => $item->getSummary(), + 'comment' => $comment, + 'cancomment' => $item->cancomment(), + 'hits' => $item->counter(), + 'link' => $item->getItemLink(), + 'published' => $item->getDatesub(), + //'published' => $item->getDatesub(_SHORTDATESTRING), //'rating' => $xoopsLocal->number_format((float)$item->rating()) - 'rating' => $item->rating(), - 'image' => $image, + 'rating' => $item->rating(), + 'image' => $image, ]; } } unset($item); $xoopsTpl->assign('categories', $categories); -$title = _MD_PUBLISHER_ITEMS_SAME_AUTHOR . ' - ' . $author_name; +$title = _MD_PUBLISHER_ITEMS_SAME_AUTHOR . ' - ' . $authorName; /** * Generating meta information for this page diff --git a/backend.php b/backend.php index 24846f9e..e145f047 100644 --- a/backend.php +++ b/backend.php @@ -14,15 +14,12 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Action * @since 1.0 * @author trabis * @author The SmartFactory */ use Xmf\Request; -use XoopsModules\Publisher; require_once __DIR__ . '/header.php'; //xoops_load('XoopsLocal'); //mb @@ -35,10 +32,10 @@ mb_http_output('pass'); } -$categoryid = Request::getInt('categoryid', -1, 'GET'); +$categoryId = Request::getInt('categoryid', -1, 'GET'); -if (-1 != $categoryid) { - $categoryObj = $helper->getHandler('Category')->get($categoryid); +if (-1 != $categoryId) { + $categoryObj = $helper->getHandler('Category')->get($categoryId); } header('Content-Type:text/xml; charset=' . _CHARSET); @@ -46,15 +43,15 @@ $tpl->caching = 2; //$tpl->xoops_setCacheTime(0); $tpl->cache_lifetime = 0; -$myts = \MyTextSanitizer::getInstance(); +$myts = \MyTextSanitizer::getInstance(); if (!$tpl->is_cached('db:publisher_rss.tpl')) { // xoops_load('XoopsLocal'); - $channel_category = $helper->getModule()->name(); + $channelCategory = $helper->getModule()->name(); // Check if ML Hack is installed, and if yes, parse the $content in formatForML if (method_exists($myts, 'formatForML')) { $GLOBALS['xoopsConfig']['sitename'] = $myts->formatForML($GLOBALS['xoopsConfig']['sitename']); $GLOBALS['xoopsConfig']['slogan'] = $myts->formatForML($GLOBALS['xoopsConfig']['slogan']); - $channel_category = $myts->formatForML($channel_category); + $channelCategory = $myts->formatForML($channelCategory); } $tpl->assign('channel_charset', _CHARSET); $tpl->assign('channel_title', htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5)); @@ -65,11 +62,11 @@ $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) { - $channel_category .= ' > ' . $categoryObj->name(); + if (-1 != $categoryId) { + $channelCategory .= ' > ' . $categoryObj->name(); } - $tpl->assign('channel_category', htmlspecialchars($channel_category, ENT_QUOTES | ENT_HTML5)); + $tpl->assign('channelCategory', htmlspecialchars($channelCategory, ENT_QUOTES | ENT_HTML5)); $tpl->assign('channel_generator', $helper->getModule()->name()); $tpl->assign('channel_language', _LANGCODE); $tpl->assign('image_url', XOOPS_URL . '/images/logo.png'); @@ -85,18 +82,18 @@ $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) { $tpl->append( 'items', [ - 'title' => htmlspecialchars($item->getTitle(), ENT_QUOTES | ENT_HTML5), - 'link' => htmlspecialchars($item->getItemUrl(), ENT_QUOTES | ENT_HTML5), - 'guid' => $item->getItemUrl(), - //mb 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'), - 'pubdate' => formatTimestamp($item->getVar('datesub'), 'rss'), + 'title' => htmlspecialchars($item->getTitle(), ENT_QUOTES | ENT_HTML5), + 'link' => htmlspecialchars($item->getItemUrl(), ENT_QUOTES | ENT_HTML5), + 'guid' => $item->getItemUrl(), + //mb 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'), + 'pubdate' => formatTimestamp($item->getVar('datesub'), 'rss'), 'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES | ENT_HTML5), ] ); diff --git a/blocks/category_items_sel.php b/blocks/category_items_sel.php index 98e42e05..149eb164 100644 --- a/blocks/category_items_sel.php +++ b/blocks/category_items_sel.php @@ -14,16 +14,13 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis */ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/include/common.php'; @@ -34,7 +31,6 @@ */ function publisher_category_items_sel_show($options) { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); $block = $item = []; @@ -49,14 +45,14 @@ function publisher_category_items_sel_show($options) $selectedcatids = explode(',', $options[0]); $sort = $options[1]; - $order = Publisher\Utility::getOrderBy($sort); + $order = Utility::getOrderBy($sort); $limit = $options[2]; $start = 0; // creating the ITEM objects that belong to the selected category $block['categories'] = []; foreach ($categories as $catId => $catObj) { - if (!in_array(0, $selectedcatids) && !in_array($catId, $selectedcatids)) { + if (!in_array(0, $selectedcatids, true) && !in_array($catId, $selectedcatids, true)) { continue; } @@ -95,10 +91,6 @@ function publisher_category_items_sel_show($options) unset($items, $categories, $itemObj, $catId, $catObj); - if (0 === count($block['categories'])) { - return $block; - } - return $block; } @@ -114,7 +106,7 @@ function publisher_category_items_sel_edit($options) $form = new Publisher\BlockForm(); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[0]), 'options[0]'); + $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0]), 'options[0]'); $orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray( [ diff --git a/blocks/date_to_date.php b/blocks/date_to_date.php index 2abf5e6d..904a6391 100644 --- a/blocks/date_to_date.php +++ b/blocks/date_to_date.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author The SmartFactory @@ -23,8 +21,6 @@ use XoopsModules\Publisher; - - require_once dirname(__DIR__) . '/include/common.php'; /** @@ -35,7 +31,6 @@ function publisher_date_to_date_show($options) { $myts = \MyTextSanitizer::getInstance(); - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); $block = $newItems = []; diff --git a/blocks/items_columns.php b/blocks/items_columns.php index f1fbde02..b4bf72e3 100644 --- a/blocks/items_columns.php +++ b/blocks/items_columns.php @@ -14,30 +14,26 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author Bandit-x */ use XoopsModules\Publisher; - - +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/include/common.php'; /*** * Function To Show Publisher Items From Categories In Their Own Columns * - * @param array $options Block Options + * @param array $options Block Options * * @return bool|array */ function publisher_items_columns_show($options) { // global $xoTheme; - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\CategoryHandler $categoryHandler */ $categoryHandler = $helper->getHandler('Category'); @@ -60,9 +56,9 @@ function publisher_items_columns_show($options) $categoriesObj = $categoryHandler->getCategories(0, 0, -1); //if not selected 'all', let's get the selected ones - if (!in_array(0, $selCategories)) { + if (!in_array(0, $selCategories, true)) { foreach ($categoriesObj as $key => $value) { - if (in_array($key, $selCategories)) { + if (in_array($key, $selCategories, true)) { $selCategoriesObj[$key] = $value; } } @@ -98,10 +94,10 @@ function publisher_items_columns_show($options) $mainItem['itemurl'] = $thisItem->getItemUrl(); $mainItem['date'] = $thisItem->getDatesub(); - $mainImage = $thisItem->getMainImage(); + $mainImage = $thisItem->getMainImage(); if (empty($mainImage['image_path'])) { - $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; - } + $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; + } // check to see if GD function exist $mainItem['item_image'] = $mainImage['image_path']; if (!empty($mainImage['image_path']) && function_exists('imagecreatetruecolor')) { @@ -118,15 +114,15 @@ function publisher_items_columns_show($options) //The Rest if ($scount > 1) { - // while ((list($itemid, $thisItem) = each($categoryItemsObj)) !== false) { - foreach ($categoryItemsObj as $itemid => $thisItem) { + // while ((list($itemId, $thisItem) = each($categoryItemsObj)) !== false) { + foreach ($categoryItemsObj as $itemId => $thisItem) { //TODO do I need to start with 2nd element? $subItem['title'] = $thisItem->getTitle(); $subItem['cleantitle'] = strip_tags($thisItem->getTitle()); $subItem['link'] = $thisItem->getItemLink(); $subItem['itemurl'] = $thisItem->getItemUrl(); $subItem['summary'] = $thisItem->getBlockSummary($optCatTruncate); - $subItem['date'] = $thisItem->getDatesub(); + $subItem['date'] = $thisItem->getDatesub(); $mainItem['subitem'][] = $subItem; unset($subItem); } @@ -142,11 +138,11 @@ function publisher_items_columns_show($options) } unset($categoryId, $mainItemCatObj); - $block['template'] = $options[4]; - $block['columns'] = $columns; - $block['columnwidth'] = (int)(100 / $optNumColumns); - $block['display_datemainitem'] = $options[5]; - $block['display_datesubitem'] = $options[6]; + $block['template'] = $options[4]; + $block['columns'] = $columns; + $block['columnwidth'] = (int)(100 / $optNumColumns); + $block['display_datemainitem'] = $options[5] ?? ''; + $block['display_datesubitem'] = $options[6] ?? ''; $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/assets/css/publisher.css'); @@ -156,7 +152,7 @@ function publisher_items_columns_show($options) /*** * Edit Function For Multi-Column Category Items Display Block * - * @param array $options Block Options + * @param array $options Block Options * * @return string */ @@ -169,34 +165,36 @@ function publisher_items_columns_edit($options) $colEle = new \XoopsFormSelect(_MB_PUBLISHER_NUMBER_COLUMN_VIEW, 'options[0]', $options[0]); $colEle->addOptionArray( [ - '1' => 1, - '2' => 2, - '3' => 3, - '4' => 4, - '5' => 5, + '1' => 1, + '2' => 2, + '3' => 3, + '4' => 4, + '5' => 5, ] ); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[1], 0, true, 'options[1]')); + $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[1], 0, true, 'options[1]')); - $cItemsEle = new \XoopsFormText(_MB_PUBLISHER_NUMBER_ITEMS_CAT, 'options[2]', 4, 255, $options[2]); + $cItemsEle = new \XoopsFormText(_MB_PUBLISHER_NUMBER_ITEMS_CAT, 'options[2]', 4, 255, $options[2]); $truncateEle = new \XoopsFormText(_MB_PUBLISHER_TRUNCATE, 'options[3]', 4, 255, $options[3]); $tempEle = new \XoopsFormSelect(_MB_PUBLISHER_TEMPLATE, 'options[4]', $options[4]); $tempEle->addOptionArray( [ - 'normal' => _MB_PUBLISHER_TEMPLATE_NORMAL, - 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED, - ]); + 'normal' => _MB_PUBLISHER_TEMPLATE_NORMAL, + 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED, + ] + ); $dateMain = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_DATE_MAINITEM, 'options[5]', $options[5]); - $dateSub = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_DATE_SUBITEM, 'options[6]', $options[6]); + $dateSub = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_DATE_SUBITEM, 'options[6]', $options[6]); $form->addElement($colEle); $form->addElement($catEle); $form->addElement($cItemsEle); $form->addElement($truncateEle); $form->addElement($tempEle); - $form->addElement($dateMain); - $form->addElement($dateSub); + $form->addElement($dateMain); + $form->addElement($dateSub); + return $form->render(); } diff --git a/blocks/items_menu.php b/blocks/items_menu.php index b5a92ef8..acbcc93e 100644 --- a/blocks/items_menu.php +++ b/blocks/items_menu.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author The SmartFactory @@ -23,8 +21,7 @@ use Xmf\Request; use XoopsModules\Publisher; - - +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/include/common.php'; @@ -37,7 +34,6 @@ function publisher_items_menu_show($options) { $block = []; - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); // Getting all top cats @@ -54,13 +50,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 +65,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); } } @@ -89,7 +85,7 @@ function publisher_items_menu_edit($options) $form = new Publisher\BlockForm(); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]')); + $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray( [ diff --git a/blocks/items_new.php b/blocks/items_new.php index 537a2a68..42b0377b 100644 --- a/blocks/items_new.php +++ b/blocks/items_new.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,8 +22,6 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - require_once dirname(__DIR__) . '/include/common.php'; /** @@ -35,7 +31,6 @@ */ function publisher_items_new_show($options) { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\ItemHandler $itemHandler */ $itemHandler = $helper->getHandler('Item'); @@ -44,7 +39,7 @@ function publisher_items_new_show($options) $block = []; $allcats = false; - if (in_array(0, $selectedcatids)) { + if (in_array(0, $selectedcatids, true)) { $allcats = true; } @@ -62,42 +57,42 @@ function publisher_items_new_show($options) $criteria->add(new \Criteria('categoryid', '(' . $options[0] . ')', 'IN')); } - $publisherIsAdmin = $helper->isUserAdmin(); - if (!$publisherIsAdmin) { - if (null === $criteria) { - $criteria = new \CriteriaCompo(); - } - $criteriaDateSub = new \Criteria('datesub', time(), '<='); - $criteria->add($criteriaDateSub); + $publisherIsAdmin = $helper->isUserAdmin(); + if (!$publisherIsAdmin) { + if (null === $criteria) { + $criteria = new \CriteriaCompo(); } + $criteriaDateSub = new \Criteria('datesub', time(), '<='); + $criteria->add($criteriaDateSub); + } -// $optCatItems = (int)$options[2]; -// $categoryId = -1; -// $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId); + // $optCatItems = (int)$options[2]; + // $categoryId = -1; + // $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId); $itemsObj = $itemHandler->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none'); $totalitems = count($itemsObj); if ($totalitems > 0) { foreach ($itemsObj as $iValue) { - $item = []; - $item['itemurl']= $iValue->getItemUrl(); - $item['link'] = $iValue->getItemLink(false, $options[4] ?? 65); - $item['id'] = $iValue->itemid(); - $item['poster'] = $iValue->posterName(); // for make poster name linked, use getLinkedPosterName() instead of posterName() + $item = []; + $item['itemurl'] = $iValue->getItemUrl(); + $item['link'] = $iValue->getItemLink(false, $options[4] ?? 65); + $item['id'] = $iValue->itemid(); + $item['poster'] = $iValue->posterName(); // for make poster name linked, use getLinkedPosterName() instead of posterName() $item['categorylink'] = $iValue->getCategoryLink(); - $item['date'] = $iValue->getDatesub(); - $item['hits'] = $iValue->counter(); - $item['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available - $item['rating'] = $iValue->rating(); - $item['votes'] = $iValue->votes(); - $item['lang_fullitem'] = _MB_PUBLISHER_FULLITEM; - $item['lang_poster'] = _MB_PUBLISHER_POSTEDBY; - $item['lang_date'] = _MB_PUBLISHER_ON; - $item['lang_category'] = _MB_PUBLISHER_CATEGORY; - $item['lang_hits'] = _MB_PUBLISHER_TOTALHITS; - $item['cancomment'] = $iValue->cancomment(); - $comments = $iValue->comments(); + $item['date'] = $iValue->getDatesub(); + $item['hits'] = $iValue->counter(); + $item['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available + $item['rating'] = $iValue->rating(); + $item['votes'] = $iValue->votes(); + $item['lang_fullitem'] = _MB_PUBLISHER_FULLITEM; + $item['lang_poster'] = _MB_PUBLISHER_POSTEDBY; + $item['lang_date'] = _MB_PUBLISHER_ON; + $item['lang_category'] = _MB_PUBLISHER_CATEGORY; + $item['lang_hits'] = _MB_PUBLISHER_TOTALHITS; + $item['cancomment'] = $iValue->cancomment(); + $comments = $iValue->comments(); if ($comments > 0) { //shows 1 comment instead of 1 comm. if comments ==1 //langugage file modified accordingly @@ -109,25 +104,22 @@ function publisher_items_new_show($options) } else { $item['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; } - - - if ('article' === $image) { - $item['image'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; + $item['image'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; $item['image_name'] = ''; $images = $iValue->getImages(); - - if (empty($images['image_path'])) { - $images['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; - } + + if (empty($images['image_path'])) { + $images['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; + } if (is_object($images['main'])) { // check to see if GD function exist if (!function_exists('imagecreatetruecolor')) { $item['image'] = XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name'); } else { - $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . ''; - $item['image_path'] = XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . ''; + $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . ''; + $item['image_path'] = XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . ''; } $item['image_name'] = $images['main']->getVar('image_nicename'); } @@ -146,14 +138,13 @@ function publisher_items_new_show($options) $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $images['main']->getVar('image_name') . '&w=50'; } } - } else { // check to see if GD function exist - if (!function_exists('imagecreatetruecolor')) { - $item['image'] = XOOPS_URL . '/uploads/' . $iValue->posterAvatar(); - } else { - $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $iValue->posterAvatar() . '&w=50'; - } + } elseif (!function_exists('imagecreatetruecolor')) { + $item['image'] = XOOPS_URL . '/uploads/' . $iValue->posterAvatar(); + } else { + $item['image'] = PUBLISHER_URL . '/thumb.php?src=' . XOOPS_URL . '/uploads/' . $iValue->posterAvatar() . '&w=50'; } + $item['image_name'] = $iValue->posterName(); } @@ -177,14 +168,15 @@ function publisher_items_new_show($options) } } - $block['show_order'] = $options[2]; - $block['show_summary'] = $options[6]; - $block['show_poster'] =$options[7]; - $block['show_date'] =$options[8]; - $block['show_category'] =$options[9]; - $block['show_hits'] =$options[10]; - $block['show_comment'] =$options[11]; - $block['show_rating'] =$options[12]; + $block['show_order'] = $options[2]; + $block['show_summary'] = $options[6]; + $block['show_poster'] = $options[7]; + $block['show_date'] = $options[8]; + $block['show_category'] = $options[9]; + $block['show_hits'] = $options[10]; + $block['show_comment'] = $options[11]; + $block['show_rating'] = $options[12]; + return $block; } @@ -204,12 +196,12 @@ function publisher_items_new_edit($options) $orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray( [ - 'datesub' => _MB_PUBLISHER_DATE, - 'counter' => _MB_PUBLISHER_HITS, - 'weight' => _MB_PUBLISHER_WEIGHT, - 'rating' => _MI_PUBLISHER_ORDERBY_RATING, - 'votes' => _MI_PUBLISHER_ORDERBY_VOTES, - 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS, + 'datesub' => _MB_PUBLISHER_DATE, + 'counter' => _MB_PUBLISHER_HITS, + 'weight' => _MB_PUBLISHER_WEIGHT, + 'rating' => _MI_PUBLISHER_ORDERBY_RATING, + 'votes' => _MI_PUBLISHER_ORDERBY_VOTES, + 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS, ] ); @@ -220,19 +212,19 @@ function publisher_items_new_edit($options) $imageEle = new \XoopsFormSelect(_MB_PUBLISHER_IMAGE_TO_DISPLAY, 'options[5]', $options[5]); $imageEle->addOptionArray( [ - 'none' => _NONE, - 'article' => _MB_PUBLISHER_IMAGE_ARTICLE, - 'category' => _MB_PUBLISHER_IMAGE_CATEGORY, - 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR, + 'none' => _NONE, + 'article' => _MB_PUBLISHER_IMAGE_ARTICLE, + 'category' => _MB_PUBLISHER_IMAGE_CATEGORY, + 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR, ] ); $showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[6]', $options[6]); - $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]); - $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]); - $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[9]', $options[9]); - $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[10]', $options[10]); + $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]); + $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]); + $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[9]', $options[9]); + $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[10]', $options[10]); $showComment = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_COMMENT, 'options[11]', $options[11]); - $showRating = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_RATING, 'options[12]', $options[12]); + $showRating = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_RATING, 'options[12]', $options[12]); $form->addElement($catEle); $form->addElement($orderEle); @@ -240,12 +232,12 @@ function publisher_items_new_edit($options) $form->addElement($dispEle); $form->addElement($charsEle); $form->addElement($imageEle); - $form->addElement($showSummary); + $form->addElement($showSummary); $form->addElement($showPoster); $form->addElement($showDate); - $form->addElement($showCategory); - $form->addElement($showHits); - $form->addElement($showComment); + $form->addElement($showCategory); + $form->addElement($showHits); + $form->addElement($showComment); $form->addElement($showRating); return $form->render(); diff --git a/blocks/items_random_item.php b/blocks/items_random_item.php index 59874a0b..6cabaa64 100644 --- a/blocks/items_random_item.php +++ b/blocks/items_random_item.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,8 +22,6 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - require_once dirname(__DIR__) . '/include/common.php'; /** @@ -38,8 +34,7 @@ function publisher_items_random_item_show($options) { $block = []; - - /** @var Publisher\Helper $helper */ + $helper = Publisher\Helper::getInstance(); /** @var Publisher\ItemHandler $itemHandler */ $itemHandler = $helper->getHandler('Item'); @@ -54,54 +49,54 @@ function publisher_items_random_item_show($options) $block['id'] = $itemsObj->itemid(); $block['url'] = $itemsObj->getItemUrl(); $block['lang_fullitem'] = _MB_PUBLISHER_FULLITEM; - $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY; - $block['lang_date'] = _MB_PUBLISHER_ON; - $block['lang_category'] = _MB_PUBLISHER_CATEGORY; - $block['lang_reads'] = _MB_PUBLISHER_HITS; - $block['titlelink'] = $itemsObj->getItemLink('titlelink'); - $block['alt'] = strip_tags($itemsObj->getItemLink()); + $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY; + $block['lang_date'] = _MB_PUBLISHER_ON; + $block['lang_category'] = _MB_PUBLISHER_CATEGORY; + $block['lang_reads'] = _MB_PUBLISHER_HITS; + $block['titlelink'] = $itemsObj->getItemLink('titlelink'); + $block['alt'] = strip_tags($itemsObj->getItemLink()); $block['date'] = $itemsObj->getDatesub(); $block['poster'] = $itemsObj->getLinkedPosterName(); $block['categorylink'] = $itemsObj->getCategoryLink(); - $block['hits'] = ' ' . $itemsObj->counter() . ' ' . _READS . ''; - - $mainImage = $itemsObj->getMainImage(); // check to see if GD function exist - if (empty($mainImage['image_path'])) { - $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; - } - if (!function_exists('imagecreatetruecolor')) { - $block['item_image'] = $mainImage['image_path']; - } else { - $block['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; - $block['image_path'] = $mainImage['image_path']; - } - - $block['cancomment'] = $itemsObj->cancomment(); - $comments = $itemsObj->comments(); - if ($comments > 0) { - //shows 1 comment instead of 1 comm. if comments ==1 - //langugage file modified accordingly - if (1 == $comments) { - $block['comment'] = ' ' . _MB_PUBLISHER_ONECOMMENT . ' '; - } else { - $block['comment'] = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' '; - } - } else { - $block['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; - } - $block['display_summary'] =$options[0]; - $block['display_item_image'] =$options[1]; - $block['display_poster'] =$options[2]; - $block['display_date'] =$options[3]; - $block['display_categorylink'] =$options[4]; - $block['display_hits'] =$options[5]; - $block['display_comment'] =$options[6]; - $block['display_lang_fullitem'] =$options[7]; - - $block['items'][] = $block; - return $block; - - } + $block['hits'] = ' ' . $itemsObj->counter() . ' ' . _READS . ''; + + $mainImage = $itemsObj->getMainImage(); // check to see if GD function exist + if (empty($mainImage['image_path'])) { + $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; + } + if (!function_exists('imagecreatetruecolor')) { + $block['item_image'] = $mainImage['image_path']; + } else { + $block['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; + $block['image_path'] = $mainImage['image_path']; + } + + $block['cancomment'] = $itemsObj->cancomment(); + $comments = $itemsObj->comments(); + if ($comments > 0) { + //shows 1 comment instead of 1 comm. if comments ==1 + //langugage file modified accordingly + if (1 == $comments) { + $block['comment'] = ' ' . _MB_PUBLISHER_ONECOMMENT . ' '; + } else { + $block['comment'] = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' '; + } + } else { + $block['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; + } + $block['display_summary'] = $options[0]; + $block['display_item_image'] = $options[1]; + $block['display_poster'] = $options[2]; + $block['display_date'] = $options[3]; + $block['display_categorylink'] = $options[4]; + $block['display_hits'] = $options[5]; + $block['display_comment'] = $options[6]; + $block['display_lang_fullitem'] = $options[7]; + + $block['items'][] = $block; + + return $block; +} /** * @param $options @@ -112,24 +107,24 @@ function publisher_items_random_item_edit($options) // require_once PUBLISHER_ROOT_PATH . '/class/blockform.php'; xoops_load('XoopsFormLoader'); - $form = new Publisher\BlockForm(); - $showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[0]', $options[0]); - $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[1]', $options[1]); - $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[2]', $options[2]); - $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[3]', $options[3]); - $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[4]', $options[4]); - $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[5]', $options[5]); + $form = new Publisher\BlockForm(); + $showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[0]', $options[0]); + $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[1]', $options[1]); + $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[2]', $options[2]); + $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[3]', $options[3]); + $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[4]', $options[4]); + $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[5]', $options[5]); $showComment = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_COMMENT, 'options[6]', $options[6]); - $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[7]', $options[7]); - - $form->addElement($showSummary); + $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[7]', $options[7]); + + $form->addElement($showSummary); $form->addElement($showImage); $form->addElement($showPoster); $form->addElement($showDate); - $form->addElement($showCategory); - $form->addElement($showHits); - $form->addElement($showComment); - $form->addElement($dispMoreEle); - + $form->addElement($showCategory); + $form->addElement($showHits); + $form->addElement($showComment); + $form->addElement($dispMoreEle); + return $form->render(); } diff --git a/blocks/items_recent.php b/blocks/items_recent.php index 86420624..f58a39ea 100644 --- a/blocks/items_recent.php +++ b/blocks/items_recent.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,8 +22,6 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - require_once dirname(__DIR__) . '/include/common.php'; /** @@ -35,7 +31,6 @@ */ function publisher_items_recent_show($options) { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\ItemHandler $itemHandler */ $itemHandler = $helper->getHandler('Item'); @@ -79,9 +74,9 @@ function publisher_items_recent_show($options) if ($itemsObj && $totalItems > 0) { foreach ($itemsObj as $iValue) { $newItems['itemid'] = $iValue->itemid(); - $newItems['itemurl'] = $iValue->getItemUrl(); + $newItems['itemurl'] = $iValue->getItemUrl(); $newItems['title'] = $iValue->getTitle(); - $newItems['alt'] = strip_tags($iValue->getItemLink()); + $newItems['alt'] = strip_tags($iValue->getItemLink()); $newItems['categoryname'] = $iValue->getCategoryName(); $newItems['categoryid'] = $iValue->categoryid(); $newItems['date'] = $iValue->getDatesub(); @@ -89,20 +84,20 @@ function publisher_items_recent_show($options) $newItems['itemlink'] = $iValue->getItemLink(false, $options[3] ?? 65); $newItems['categorylink'] = $iValue->getCategoryLink(); $newItems['hits'] = ' ' . $iValue->counter() . ' ' . _READS . ''; - $newItems['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available - - $mainImage = $iValue->getMainImage(); // check to see if GD function exist - if (empty($mainImage['image_path'])) { - $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; - } - if (!function_exists('imagecreatetruecolor')) { - $newItems['item_image'] = $mainImage['image_path']; - } else { - $newItems['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; - $newItems['image_path'] = $mainImage['image_path']; - } - $newItems['cancomment'] = $iValue->cancomment(); - $comments = $iValue->comments(); + $newItems['summary'] = $iValue->getBlockSummary(300, true); //show complete summary but truncate to 300 if only body available + + $mainImage = $iValue->getMainImage(); // check to see if GD function exist + if (empty($mainImage['image_path'])) { + $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; + } + if (!function_exists('imagecreatetruecolor')) { + $newItems['item_image'] = $mainImage['image_path']; + } else { + $newItems['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . ''; + $newItems['image_path'] = $mainImage['image_path']; + } + $newItems['cancomment'] = $iValue->cancomment(); + $comments = $iValue->comments(); if ($comments > 0) { //shows 1 comment instead of 1 comm. if comments ==1 //langugage file modified accordingly @@ -112,31 +107,28 @@ function publisher_items_recent_show($options) $newItems['comment'] = ' ' . $comments . ' ' . _MB_PUBLISHER_COMMENTS . ' '; } } else { - $newItems['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; + $newItems['comment'] = ' ' . _MB_PUBLISHER_NO_COMMENTS . ' '; } - - - + $block['items'][] = $newItems; } - $block['publisher_url'] = PUBLISHER_URL; + $block['publisher_url'] = PUBLISHER_URL; $block['lang_title'] = _MB_PUBLISHER_ITEMS; $block['lang_category'] = _MB_PUBLISHER_CATEGORY; $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY; $block['lang_date'] = _MB_PUBLISHER_DATE; $moduleName = $myts->displayTarea($helper->getModule()->getVar('name')); $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . ' ' . $moduleName; - - $block['show_image'] = $options[4]; - $block['show_summary'] = $options[5]; - $block['show_category'] =$options[6]; - $block['show_poster'] =$options[7]; - $block['show_date'] =$options[8]; - $block['show_hits'] =$options[9]; - $block['show_comment'] =$options[10]; - $block['show_morelink'] =$options[11]; - - } + + $block['show_image'] = $options[4]; + $block['show_summary'] = $options[5]; + $block['show_category'] = $options[6]; + $block['show_poster'] = $options[7]; + $block['show_date'] = $options[8]; + $block['show_hits'] = $options[9]; + $block['show_comment'] = $options[10]; + $block['show_morelink'] = $options[11]; + } return $block; } @@ -162,29 +154,29 @@ function publisher_items_recent_edit($options) 'weight' => _MB_PUBLISHER_WEIGHT, ] ); - $dispEle = new \XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]); - $charsEle = new \XoopsFormText(_MB_PUBLISHER_CHARS, 'options[3]', 10, 255, $options[3]); - $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[4]', $options[4]); + $dispEle = new \XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]); + $charsEle = new \XoopsFormText(_MB_PUBLISHER_CHARS, 'options[3]', 10, 255, $options[3]); + $showImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[4]', $options[4]); $showSummary = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_SUMMARY, 'options[5]', $options[5]); - $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[6]', $options[6]); - $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]); - $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]); - $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[9]', $options[9]); + $showCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[6]', $options[6]); + $showPoster = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTEDBY, 'options[7]', $options[7]); + $showDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[8]', $options[8]); + $showHits = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[9]', $options[9]); $showComment = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_COMMENT, 'options[10]', $options[10]); - $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[11]', $options[11]); - - + $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[11]', $options[11]); + $form->addElement($catEle); $form->addElement($orderEle); $form->addElement($dispEle); $form->addElement($charsEle); - $form->addElement($showImage); - $form->addElement($showSummary); - $form->addElement($showCategory); - $form->addElement($showPoster); + $form->addElement($showImage); + $form->addElement($showSummary); + $form->addElement($showCategory); + $form->addElement($showPoster); $form->addElement($showDate); - $form->addElement($showHits); - $form->addElement($showComment); + $form->addElement($showHits); + $form->addElement($showComment); $form->addElement($dispMoreEle); + return $form->render(); } diff --git a/blocks/items_spot.php b/blocks/items_spot.php index ffeccf65..b0f0e801 100644 --- a/blocks/items_spot.php +++ b/blocks/items_spot.php @@ -14,16 +14,13 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author The SmartFactory */ use XoopsModules\Publisher; - - +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/include/common.php'; @@ -35,32 +32,31 @@ function publisher_items_spot_show($options) { // global $xoTheme; - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\CategoryHandler $categoryHandler */ $categoryHandler = $helper->getHandler('Category'); /** @var Publisher\ItemHandler $itemHandler */ $itemHandler = $helper->getHandler('Item'); - xoops_loadLanguage('main', 'publisher'); + xoops_loadLanguage('main', 'publisher'); + + $optDisplayLast = $options[0]; + $optItemsCount = $options[1]; + $optCategoryId = $options[2]; + $selItems = isset($options[3]) ? explode(',', $options[3]) : ''; + $optDisplayPoster = $options[4]; + $optDisplayComment = $options[5]; + $optDisplayType = $options[6]; + $optTruncate = (int)$options[7]; + $optCatImage = $options[8]; + $optSortOrder = $options[9] ?? ''; + $optBtnDisplayMore = $options[10] ?? ''; + $optDisplayReads = $options[11] ?? ''; + $optdisplayitemimage = $options[12] ?? ''; + $optdisplaywhenlink = $options[13] ?? ''; + $optdisplaycategorylink = $options[14] ?? ''; + $optdisplayadminlink = $options[15] ?? ''; + $optdisplayreadmore = $options[16] ?? ''; - $optDisplayLast = $options[0]; - $optItemsCount = $options[1]; - $optCategoryId = $options[2]; - $selItems = isset($options[3]) ? explode(',', $options[3]) : ''; - $optDisplayPoster = $options[4]; - $optDisplayComment = $options[5]; - $optDisplayType = $options[6]; - $optTruncate = (int)$options[7]; - $optCatImage = $options[8]; - $optSortOrder = $options[9] ?? ''; - $optBtnDisplayMore = $options[10] ?? ''; - $optDisplayReads = $options[11] ?? ''; - $optdisplayitemimage=$options[12]; - $optdisplaywhenlink=$options[13]; - $optdisplaycategorylink=$options[14]; - $optdisplayadminlink=$options[15]; - $optdisplayreadmore =$options[16]; - if (0 == $optCategoryId) { $optCategoryId = -1; } @@ -106,7 +102,7 @@ function publisher_items_spot_show($options) $category['name'] = $cat->name; $category['categoryurl'] = $cat->getCategoryUrl(); if ('blank.png' !== $cat->getImage()) { - $category['image_path'] = Publisher\Utility::getImageDir('category', false) . $cat->getImage(); + $category['image_path'] = Utility::getImageDir('category', false) . $cat->getImage(); } else { $category['image_path'] = ''; } @@ -145,7 +141,7 @@ function publisher_items_spot_show($options) } if ($optTruncate > 0) { $block['truncate'] = true; - $item['summary'] = Publisher\Utility::truncateHtml($item['summary'], $optTruncate); + $item['summary'] = Utility::truncateHtml($item['summary'], $optTruncate); } $block['items'][] = $item; ++$i; @@ -156,25 +152,25 @@ function publisher_items_spot_show($options) if (!isset($block['items']) || 0 == count($block['items'])) { return false; } - $block['lang_reads'] = _MB_PUBLISHER_READS; - $block['lang_comments'] = _MB_PUBLISHER_COMMENTS; - $block['lang_readmore'] = _MB_PUBLISHER_READMORE; - $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY; - $block['lang_date'] = _MB_PUBLISHER_ON; - $block['lang_category'] = _MB_PUBLISHER_CATEGORY; - + $block['lang_reads'] = _MB_PUBLISHER_READS; + $block['lang_comments'] = _MB_PUBLISHER_COMMENTS; + $block['lang_readmore'] = _MB_PUBLISHER_READMORE; + $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY; + $block['lang_date'] = _MB_PUBLISHER_ON; + $block['lang_category'] = _MB_PUBLISHER_CATEGORY; + $block['display_whowhen_link'] = $optDisplayPoster; - $block['display_who_link'] = $optDisplayPoster; + $block['display_who_link'] = $optDisplayPoster; $block['display_comment_link'] = $optDisplayComment; $block['display_type'] = $optDisplayType; $block['display_reads'] = $optDisplayReads; - $block['display_cat_image'] = $optCatImage; - $block['display_item_image'] =$optdisplayitemimage; - $block['display_when_link'] =$optdisplaywhenlink; - $block['display_categorylink'] =$optdisplaycategorylink; - $block['display_adminlink'] =$optdisplayadminlink; - $block['display_readmore'] =$optdisplayreadmore; - + $block['display_cat_image'] = $optCatImage; + $block['display_item_image'] = $optdisplayitemimage; + $block['display_when_link'] = $optdisplaywhenlink; + $block['display_categorylink'] = $optdisplaycategorylink; + $block['display_adminlink'] = $optdisplayadminlink; + $block['display_readmore'] = $optdisplayreadmore; + if ($optBtnDisplayMore) { $block['lang_displaymore'] = _MB_PUBLISHER_MORE_ITEMS; } @@ -197,8 +193,7 @@ function publisher_items_spot_edit($options) $form = new Publisher\BlockForm(); $autoEle = new \XoopsFormRadioYN(_MB_PUBLISHER_AUTO_LAST_ITEMS, 'options[0]', $options[0]); $countEle = new \XoopsFormText(_MB_PUBLISHER_LAST_ITEMS_COUNT, 'options[1]', 2, 255, $options[1]); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[2], 0, true, 'options[2]', false)); - /** @var Publisher\Helper $helper */ + $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[2], 0, true, 'options[2]', false)); $helper = Publisher\Helper::getInstance(); /** @var Publisher\ItemHandler $itemHandler */ $itemHandler = $helper->getHandler('Item'); @@ -220,8 +215,8 @@ function publisher_items_spot_edit($options) $typeEle = new \XoopsFormSelect(_MB_PUBLISHER_DISPLAY_TYPE, 'options[6]', $options[6]); $typeEle->addOptionArray( [ - 'block' => _MB_PUBLISHER_DISPLAY_TYPE_BLOCK, - 'bullet' => _MB_PUBLISHER_DISPLAY_TYPE_BULLET, + 'block' => _MB_PUBLISHER_DISPLAY_TYPE_BLOCK, + 'bullet' => _MB_PUBLISHER_DISPLAY_TYPE_BULLET, ] ); $truncateEle = new \XoopsFormText(_MB_PUBLISHER_TRUNCATE, 'options[7]', 4, 255, $options[7]); @@ -229,39 +224,40 @@ function publisher_items_spot_edit($options) $sortEle = new \XoopsFormSelect(_MI_PUBLISHER_ORDERBY, 'options[9]', $options[9]); $sortEle->addOptionArray( [ - 'title' => _MI_PUBLISHER_ORDERBY_TITLE, - 'date' => _MI_PUBLISHER_ORDERBY_DATE, - 'counter' => _MI_PUBLISHER_ORDERBY_HITS, - 'rating' => _MI_PUBLISHER_ORDERBY_RATING, - 'votes' => _MI_PUBLISHER_ORDERBY_VOTES, - 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS, - 'weight' => _MI_PUBLISHER_ORDERBY_WEIGHT, + 'title' => _MI_PUBLISHER_ORDERBY_TITLE, + 'date' => _MI_PUBLISHER_ORDERBY_DATE, + 'counter' => _MI_PUBLISHER_ORDERBY_HITS, + 'rating' => _MI_PUBLISHER_ORDERBY_RATING, + 'votes' => _MI_PUBLISHER_ORDERBY_VOTES, + 'comments' => _MI_PUBLISHER_ORDERBY_COMMENTS, + 'weight' => _MI_PUBLISHER_ORDERBY_WEIGHT, ] ); - $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[10]', $options[10]); - $readsEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[11]', $options[11]); - $dispImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[12]', $options[12]); - $dispDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[13]', $options[13]); - $dispCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[14]', $options[14]); - $dispAdminlink = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_ADMINLINK, 'options[15]', $options[15]); - $dispReadmore = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[16]', $options[16]); - + $dispMoreEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_MORELINK, 'options[10]', $options[10]); + $readsEle = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ, 'options[11]', $options[11]); + $dispImage = new \XoopsFormRadioYN(_MB_PUBLISHER_IMGDISPLAY, 'options[12]', $options[12]); + $dispDate = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_POSTTIME, 'options[13]', $options[13]); + $dispCategory = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_TOPICLINK, 'options[14]', $options[14]); + $dispAdminlink = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_ADMINLINK, 'options[15]', $options[15]); + $dispReadmore = new \XoopsFormRadioYN(_MB_PUBLISHER_DISPLAY_READ_FULLITEM, 'options[16]', $options[16]); + $form->addElement($autoEle); $form->addElement($countEle); $form->addElement($catEle); $form->addElement($itemEle); $form->addElement($whoEle); - $form->addElement($comEle); + $form->addElement($comEle); $form->addElement($typeEle); $form->addElement($truncateEle); $form->addElement($imageEle); $form->addElement($sortEle); $form->addElement($dispMoreEle); $form->addElement($readsEle); - $form->addElement($dispImage); - $form->addElement($dispDate); - $form->addElement($dispCategory); - $form->addElement($dispAdminlink); - $form->addElement($dispReadmore); + $form->addElement($dispImage); + $form->addElement($dispDate); + $form->addElement($dispCategory); + $form->addElement($dispAdminlink); + $form->addElement($dispReadmore); + return $form->render(); } diff --git a/blocks/latest_files.php b/blocks/latest_files.php index 9b89ee8e..496fa314 100644 --- a/blocks/latest_files.php +++ b/blocks/latest_files.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author The SmartFactory @@ -23,8 +21,7 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/include/common.php'; @@ -35,7 +32,6 @@ */ function publisher_latest_files_show($options) { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\FileHandler $fileHandler */ $fileHandler = $helper->getHandler('File'); @@ -50,7 +46,7 @@ function publisher_latest_files_show($options) $block = []; $sort = $options[1]; - $order = Publisher\Utility::getOrderBy($sort); + $order = Utility::getOrderBy($sort); $limit = $options[2]; $directDownload = $options[3]; @@ -84,7 +80,7 @@ function publisher_latest_files_edit($options) $form = new Publisher\BlockForm(); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]')); + $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, Utility::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new \XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray( [ diff --git a/blocks/latest_news.php b/blocks/latest_news.php index 74a676dd..530e12c0 100644 --- a/blocks/latest_news.php +++ b/blocks/latest_news.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author Bandit-x @@ -24,8 +22,7 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - +use XoopsModules\Publisher\Utility; require_once dirname(__DIR__) . '/include/common.php'; @@ -38,7 +35,6 @@ function publisher_latest_news_show($options) { $block = []; - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); $helper->loadLanguage('main'); /** @var Publisher\ItemHandler $itemHandler */ @@ -51,7 +47,7 @@ function publisher_latest_news_show($options) $letters = $options[3]; $selectedStories = $options[4]; $sort = $options[9]; - $order = Publisher\Utility::getOrderBy($sort); + $order = Utility::getOrderBy($sort); $imgWidth = $options[11]; $imgHeight = $options[12]; $border = $options[13]; @@ -62,7 +58,7 @@ function publisher_latest_news_show($options) $allcats = false; if (!isset($options[31])) { $allcats = true; - } elseif (in_array(0, explode(',', $options[31]))) { + } elseif (in_array(0, explode(',', $options[31]), true)) { $allcats = true; } @@ -100,7 +96,7 @@ function publisher_latest_news_show($options) $k = 0; $columns = []; - foreach ($itemsObj as $itemid => $itemObj) { + foreach ($itemsObj as $itemId => $itemObj) { $item = []; $item['itemurl'] = $itemObj->getItemUrl(); $item['title'] = $itemObj->getItemLink(); @@ -108,19 +104,19 @@ function publisher_latest_news_show($options) $mainImage = $itemObj->getMainImage(); if (empty($mainImage['image_path'])) { $mainImage['image_path'] = PUBLISHER_URL . '/assets/images/default_image.jpg'; - } + } // check to see if GD function exist if (!empty($mainImage['image_path']) && !function_exists('imagecreatetruecolor')) { $item['item_image'] = $mainImage['image_path']; } else { $item['item_image'] = PUBLISHER_URL . '/thumb.php?src=' . $mainImage['image_path'] . '&w=' . $imgWidth; // No $imgHeight for autoheight option $item['image_path'] = $mainImage['image_path']; - } - $item['text'] = $itemObj->getBlockSummary($letters); - $item['display_item_image'] =$options[10]; - $item['display_summary'] =$options[16]; - $item['display_adminlink'] =$options[29]; - $item = $itemObj->getMainImage($item); //returns an array + } + $item['text'] = $itemObj->getBlockSummary($letters); + $item['display_item_image'] = $options[10]; + $item['display_summary'] = $options[16]; + $item['display_adminlink'] = $options[29]; + $item = $itemObj->getMainImage($item); //returns an array $lsHeight = $imgPosition = $lsMargin = ''; if (0 != $options[12]) { @@ -128,24 +124,24 @@ function publisher_latest_news_show($options) } // set height = 0 in block option for auto height if ('LEFT' === $options[15]) { - $imgPosition = 'float: left'; - $lsMargin = '-right'; - $block['position'] = $imgPosition; - $block['margin'] = $lsMargin; + $imgPosition = 'float: left'; + $lsMargin = '-right'; + $block['position'] = $imgPosition; + $block['margin'] = $lsMargin; } if ('CENTER' === $options[15]) { - $imgPosition = 'text-align:center'; - $lsMargin = ''; - $block['position'] = $imgPosition; - $block['margin'] = $lsMargin; + $imgPosition = 'text-align:center'; + $lsMargin = ''; + $block['position'] = $imgPosition; + $block['margin'] = $lsMargin; } if ('RIGHT' === $options[15]) { - $imgPosition = 'float: right'; - $lsMargin = '-left'; - $block['position'] = $imgPosition; - $block['margin'] = $lsMargin; + $imgPosition = 'float: right'; + $lsMargin = '-left'; + $block['position'] = $imgPosition; + $block['margin'] = $lsMargin; } //Image @@ -166,11 +162,11 @@ function publisher_latest_news_show($options) } $block['topiclink'] = ''; - + if (1 == $options[16]) { - $block['text'] = $itemObj->getBlockSummary($letters); + $block['text'] = $itemObj->getBlockSummary($letters); } - + $block['archivelink'] = ''; if (1 == $options[17]) { $block['archivelink'] = '| ' . _MB_PUBLISHER_ARCHIVE . ' '; @@ -184,30 +180,30 @@ function publisher_latest_news_show($options) $item['poster'] = ''; if (1 == $options[19]) { - $item['poster'] = $itemObj->posterName(); - $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY; + $item['poster'] = $itemObj->posterName(); + $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY; } $item['posttime'] = ''; if (1 == $options[20]) { - $item['posttime'] = $itemObj->getDatesub(); - $block['lang_date'] = _MB_PUBLISHER_ON; + $item['posttime'] = $itemObj->getDatesub(); + $block['lang_date'] = _MB_PUBLISHER_ON; } $item['topic_title'] = ''; if (1 == $options[21]) { - $item['topic_title'] = $itemObj->getCategoryLink(); - $item['category'] = strip_tags($itemObj->getCategoryLink()); - $block['lang_category'] = _MB_PUBLISHER_CATEGORY; - } + $item['topic_title'] = $itemObj->getCategoryLink(); + $item['category'] = strip_tags($itemObj->getCategoryLink()); + $block['lang_category'] = _MB_PUBLISHER_CATEGORY; + } $item['read'] = ''; if (1 == $options[22]) { - $item['read'] = $itemObj->counter(); - $block['lang_reads'] = _MB_PUBLISHER_READS; + $item['read'] = $itemObj->counter(); + $block['lang_reads'] = _MB_PUBLISHER_READS; } - $item['cancomment'] = $itemObj->cancomment(); - $comments = $itemObj->comments(); + $item['cancomment'] = $itemObj->cancomment(); + $comments = $itemObj->comments(); if (1 == $options[23]) { if ($comments > 0) { //shows 1 comment instead of 1 comm. if comments ==1 @@ -228,14 +224,14 @@ function publisher_latest_news_show($options) } $item['pdf'] = ''; - - if (1 == $options[25]) { - $item['pdf'] = "" . _CO_PUBLISHER_PDF . " "; - } - + + if (1 == $options[25]) { + $item['pdf'] = "" . _CO_PUBLISHER_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(); + 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'] = '' . _CO_PUBLISHER_MAIL . ' '; } @@ -260,12 +256,12 @@ function publisher_latest_news_show($options) $block['template'] = $options[30]; - $block['imgwidth'] = $options[11]; - $block['imgheight'] = $options[12]; - $block['border'] = $options[13]; + $block['imgwidth'] = $options[11]; + $block['imgheight'] = $options[12]; + $block['border'] = $options[13]; $block['bordercolor'] = $options[14]; - - $block['letters'] = $letters; + + $block['letters'] = $letters; $columns[$k][] = $item; ++$k; @@ -429,7 +425,7 @@ function publisher_latest_news_edit($options) //Select Which Categories To Show $form .= $tabletag3 . _MB_PUBLISHER_TOPICSCONFIG . $tabletag4; // Topics Options $form .= $tabletag1 . _MB_PUBLISHER_TOPICSDISPLAY . $tabletag2; - $form .= Publisher\Utility::createCategorySelect($options[31], 0, true, 'options[31]'); + $form .= Utility::createCategorySelect($options[31], 0, true, 'options[31]'); $form .= ''; $form .= ''; diff --git a/blocks/search.php b/blocks/search.php index 84e2c9f4..b3fc0f73 100644 --- a/blocks/search.php +++ b/blocks/search.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Blocks * @since 1.0 * @author trabis * @author phppp @@ -24,8 +22,6 @@ use Xmf\Request; use XoopsModules\Publisher; - - require_once dirname(__DIR__) . '/include/common.php'; /** @@ -36,7 +32,6 @@ function publisher_search_show($options) { $block = []; - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\CategoryHandler $categoryHandler */ $categoryHandler = $helper->getHandler('Category'); @@ -63,15 +58,15 @@ function publisher_search_show($options) //mb TODO simplify next lines with category $category = Request::getArray('category', [], 'POST') ?: Request::getArray('category', null, 'GET'); - if (empty($category) || (is_array($category) && in_array('all', $category))) { + if (empty($category) || (is_array($category) && in_array('all', $category, true))) { $category = []; } else { $category = (!is_array($category)) ? explode(',', $category) : $category; $category = array_map('\intval', $category); } - $andor = in_array(mb_strtoupper($andor), ['OR', 'AND', 'EXACT']) ? mb_strtoupper($andor) : 'OR'; - $sortby = in_array(mb_strtolower($sortby), ['itemid', 'datesub', 'title', 'categoryid']) ? mb_strtolower($sortby) : 'itemid'; + $andor = in_array(mb_strtoupper($andor), ['OR', 'AND', 'EXACT'], true) ? mb_strtoupper($andor) : 'OR'; + $sortby = in_array(mb_strtolower($sortby), ['itemid', 'datesub', 'title', 'categoryid'], true) ? mb_strtolower($sortby) : 'itemid'; /* type */ $typeSelect = ' * @author The SmartFactory @@ -26,10 +24,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 -$categoryObj = $helper->getHandler('Category')->get($categoryid); +/** @var \XoopsModules\Publisher\Helper $helper */ +$categoryObj = $helper->getHandler('Category')->get($categoryId); // if the selected category was not found, exit if (!is_object($categoryObj) || $categoryObj->notLoaded()) { @@ -44,13 +43,13 @@ // At which record shall we start $start = Request::getInt('start', 0, 'GET'); -$item_page_id = Request::getInt('page', -1, 'GET'); +$itemPageId = Request::getInt('page', -1, 'GET'); $totalItems = $helper->getHandler('Category')->publishedItemsCount(); // 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); } @@ -64,7 +63,7 @@ require_once $GLOBALS['xoops']->path('header.php'); require_once PUBLISHER_ROOT_PATH . '/footer.php'; -$module_id = $helper->getModule()->getVar('mid'); +$moduleId = $helper->getModule()->getVar('mid'); // creating the Item objects that belong to the selected category switch ($helper->getConfig('format_order_by')) { @@ -98,7 +97,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) { @@ -122,8 +121,8 @@ $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); -$total_subcats = count($subcatsObj); +$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryId); +$totalSubcats = count($subcatsObj); $total_items = 0; @@ -131,36 +130,36 @@ if ('no' !== $helper->getConfig('idxcat_show_subcats')) { // if this category has subcats - if (isset($subcatsObj) && $total_subcats > 0) { + if (isset($subcatsObj) && $totalSubcats > 0) { foreach ($subcatsObj as $key => $subcat) { // Get the items count of this very category - $subcat_total_items = $totalItems[$key] ?? 0; + $subcatTotalItems = $totalItems[$key] ?? 0; // Do we display empty sub-cats ? - if (($subcat_total_items > 0) || ('all' === $helper->getConfig('idxcat_show_subcats'))) { - $subcat_id = $subcat->getVar('categoryid'); + if (($subcatTotalItems > 0) || ('all' === $helper->getConfig('idxcat_show_subcats'))) { + $subcatId = $subcat->getVar('categoryid'); // if we retreived the last item object for this category - if (isset($lastItemObj[$subcat_id])) { - $subcat->setVar('last_itemid', $lastItemObj[$subcat_id]->itemid()); + if (isset($lastItemObj[$subcatId])) { + $subcat->setVar('last_itemid', $lastItemObj[$subcatId]->itemid()); $subcat->setVar('last_title_link', $lastItemObj[$key]->getItemLink(false, $lastitemsize)); } - $numItems = isset($totalItems[$subcat_id]) ? $totalItems[$key] : 0; + $numItems = isset($totalItems[$subcatId]) ? $totalItems[$key] : 0; $subcat->setVar('itemcount', $numItems); // Put this subcat in the smarty variable $subcategories[$key] = $subcat->toArraySimple(); //$total += $numItems; } - if ($subcat_total_items > 0) { - $subcat_id = $subcat->getVar('categoryid'); + if ($subcatTotalItems > 0) { + $subcatId = $subcat->getVar('categoryid'); // if we retreived the last item object for this category - if (isset($lastItemObj[$subcat_id])) { - $subcat->setVar('last_itemid', $lastItemObj[$subcat_id]->itemid()); + if (isset($lastItemObj[$subcatId])) { + $subcat->setVar('last_itemid', $lastItemObj[$subcatId]->itemid()); $subcat->setVar('last_title_link', $lastItemObj[$key]->getItemLink(false, $lastitemsize)); } - $numItems = isset($totalItems[$subcat_id]) ? $totalItems[$key] : 0; + $numItems = isset($totalItems[$subcatId]) ? $totalItems[$key] : 0; $subcat->setVar('itemcount', $numItems); // Put this subcat in the smarty variable $subcategories[$key] = $subcat->toArraySimple(); @@ -174,14 +173,14 @@ $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) { /*$userids = []; if ($itemsObj) { foreach ($itemsObj as $key => $thisItem) { - $itemids[] = $thisItem->getVar('itemid'); + $itemIds[] = $thisItem->getVar('itemid'); $userids[$thisItem->uid()] = 1; } } @@ -220,7 +219,7 @@ $xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->name())); $xoopsTpl->assign('module_home', Publisher\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'); @@ -240,7 +239,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/BaseObjectHandler.php b/class/BaseObjectHandler.php index 78ba0295..2a5b52fe 100644 --- a/class/BaseObjectHandler.php +++ b/class/BaseObjectHandler.php @@ -19,7 +19,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -27,8 +26,6 @@ use XoopsModules\Publisher; - - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -36,7 +33,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author Nazar Aziz @@ -56,7 +52,6 @@ class BaseObjectHandler extends \XoopsPersistableObjectHandler * @var string */ protected $idfield = 'id'; - public $helper = null; public $publisherIsAdmin = null; @@ -89,9 +84,9 @@ public function create($isNew = true) /** * retrieve an object from the database, based on. use in child classes * - * @param int $id ID + * @param int|null $id ID * - * @param null $fields + * @param array|null $fields * @return mixed object if id exists, false if not */ public function get($id = null, $fields = null) @@ -116,11 +111,11 @@ public function get($id = null, $fields = null) /** * retrieve objects from the database * - * @param \CriteriaElement $criteria {@link CriteriaElement} - * conditions to be met - * @param bool $idAsKey Should the department ID be used as array key + * @param \CriteriaElement|null $criteria {@link CriteriaElement} + * conditions to be met + * @param bool $idAsKey Should the department ID be used as array key * - * @param bool $asObject + * @param bool $asObject * @return array array of objects */ public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, $asObject = true) //&getObjects($criteria = null, $idAsKey = false) @@ -202,7 +197,7 @@ public function insert(\XoopsObject $obj, $force = false)// insert($obj, $force /** * Create a "select" SQL query * - * @param \CriteriaElement|\CriteriaCompo $criteria {@link \CriteriaElement} to match + * @param \CriteriaElement|null $criteria {@link \CriteriaElement} to match * * @return string SQL query */ @@ -223,8 +218,7 @@ private function selectQuery(\CriteriaElement $criteria = null) /** * count objects matching a criteria * - * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement} - * to match + * @param \CriteriaElement|null $criteria {@link CriteriaElement} to match * * @return int count of objects */ @@ -272,10 +266,10 @@ public function delete(\XoopsObject $obj, $force = false) //delete($obj, $force /** * delete department matching a set of conditions * - * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement} + * @param \CriteriaElement|null $criteria {@link CriteriaElement} * - * @param bool $force - * @param bool $asObject + * @param bool $force + * @param bool $asObject * @return bool FALSE if deletion failed */ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null) @@ -294,11 +288,11 @@ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asO /** * Assign a value to 1 field for tickets matching a set of conditions * - * @param string $fieldname - * @param string $fieldvalue - * @param \CriteriaElement|\CriteriaCompo $criteria {@link \CriteriaElement} + * @param string $fieldname + * @param string $fieldvalue + * @param \CriteriaElement|null $criteria {@link \CriteriaElement} * - * @param bool $force + * @param bool $force * @return bool FALSE if update failed */ public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null, $force = false) //updateAll($fieldname, $fieldvalue, $criteria = null) diff --git a/class/BlockForm.php b/class/BlockForm.php index 809c3efe..ac259960 100644 --- a/class/BlockForm.php +++ b/class/BlockForm.php @@ -19,15 +19,12 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ use XoopsModules\Publisher; - - \xoops_load('XoopsForm'); /** diff --git a/class/Category.php b/class/Category.php index e7cad3bf..5eaa7d66 100644 --- a/class/Category.php +++ b/class/Category.php @@ -17,15 +17,14 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory */ use XoopsModules\Publisher; - - +use XoopsModules\Publisher\Helper; +use XoopsModules\Publisher\Utility; require_once \dirname(__DIR__) . '/include/common.php'; @@ -35,15 +34,14 @@ class Category extends \XoopsObject { /** - * @var Publisher\Helper + * @var Helper */ public $helper; - /** * @var array */ public $categoryPath = false; - public $categoryid; + public $categoryId; public $parentid; public $name; public $description; @@ -63,8 +61,8 @@ class Category extends \XoopsObject */ public function __construct() { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ - $this->helper = \XoopsModules\Publisher\Helper::getInstance(); + /** @var \XoopsModules\Publisher\Helper $this->helper */ + $this->helper = Helper::getInstance(); $this->initVar('categoryid', \XOBJ_DTYPE_INT, null, false); $this->initVar('parentid', \XOBJ_DTYPE_INT, null, false); $this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, true, 100); @@ -113,7 +111,7 @@ public function notLoaded() public function checkPermission() { $ret = false; - if (Publisher\Utility::userIsAdmin()) { + if (Utility::userIsAdmin()) { return true; } if (\is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->getVar('uid') == $this->moderator) { @@ -122,7 +120,7 @@ public function checkPermission() /** @var \XoopsModules\Publisher\PermissionHandler $permissionHandler */ $permissionHandler = $this->helper->getHandler('Permission'); $categoriesGranted = $permissionHandler->getGrantedItems('category_read'); - if (\in_array($this->categoryid(), $categoriesGranted)) { + if (\in_array($this->categoryid(), $categoriesGranted, true)) { $ret = true; } @@ -179,7 +177,7 @@ public function getCategoryPath($withAllLink = true) if ($parentObj->notLoaded()) { throw new \RuntimeException(_NOPERM); } - } catch (\Exception $e) { + } catch (\Throwable $e) { $this->helper->addLog($e); // redirect_header('', 1, _NOPERM); } @@ -211,7 +209,7 @@ public function getCategoryPathForMetaTitle() if ($parentObj->notLoaded()) { throw new \RuntimeException('NOT LOADED'); } - } catch (\Exception $e) { + } catch (\Throwable $e) { $this->helper->addLog($e); // redirect_header('', 1, _NOPERM); } @@ -304,7 +302,7 @@ public function sendNotifications() $tags['MODULE_NAME'] = $this->helper->getModule()->getVar('name'); $tags['CATEGORY_NAME'] = $this->name(); $tags['CATEGORY_URL'] = $this->getCategoryUrl(); - /* @var \XoopsNotificationHandler $notificationHandler */ + /** @var \XoopsNotificationHandler $notificationHandler */ $notificationHandler = \xoops_getHandler('notification'); $notificationHandler->triggerEvent('global_item', 0, 'category_created', $tags); } @@ -331,7 +329,7 @@ public function toArraySimple($category = []) $category['last_title_link'] = $this->getVar('last_title_link', 'n'); } if ('blank.png' !== $this->getImage()) { - $category['image_path'] = Publisher\Utility::getImageDir('category', false) . $this->getImage(); + $category['image_path'] = Utility::getImageDir('category', false) . $this->getImage(); } else { $category['image_path'] = ''; } @@ -356,7 +354,7 @@ public function toArrayTable($category = []) $category['last_title_link'] = $this->getVar('last_title_link', 'n'); } if ('blank.png' !== $this->getImage()) { - $category['image_path'] = Publisher\Utility::getImageDir('category', false) . $this->getImage(); + $category['image_path'] = Utility::getImageDir('category', false) . $this->getImage(); } else { $category['image_path'] = ''; } diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php index f7fe9dac..59c67219 100644 --- a/class/CategoryHandler.php +++ b/class/CategoryHandler.php @@ -17,15 +17,13 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory */ use XoopsModules\Publisher; - - +use XoopsModules\Publisher\Helper; require_once \dirname(__DIR__) . '/include/common.php'; @@ -35,7 +33,6 @@ * of Category class objects. * * @author marcan - * @package Publisher */ class CategoryHandler extends \XoopsPersistableObjectHandler { @@ -45,15 +42,11 @@ class CategoryHandler extends \XoopsPersistableObjectHandler public $helper; public $publisherIsAdmin; - /** - * @param \XoopsDatabase $db - * @param \XoopsModules\Publisher\Helper|null $helper - */ - public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null) + public function __construct(\XoopsDatabase $db = null, Helper $helper = null) { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ + /** @var Helper $this->helper */ if (null === $helper) { - $this->helper = \XoopsModules\Publisher\Helper::getInstance(); + $this->helper = Helper::getInstance(); } else { $this->helper = $helper; } @@ -163,10 +156,10 @@ public function delete(\XoopsObject $category, $force = false) //delete(&$catego /** * retrieve categories from the database * - * @param \CriteriaElement $criteria {@link CriteriaElement} conditions to be met - * @param bool $idAsKey use the categoryid as key for the array? + * @param \CriteriaElement|null $criteria {@link CriteriaElement} conditions to be met + * @param bool $idAsKey use the categoryid as key for the array? * - * @param bool $as_object + * @param bool $as_object * @return array array of XoopsItem objects */ public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, $as_object = true) //&getObjects($criteria = null, $idAsKey = false) @@ -397,10 +390,10 @@ public function getSubCats($categories) /** * delete categories matching a set of conditions * - * @param \CriteriaElement $criteria {@link CriteriaElement} + * @param \CriteriaElement|null $criteria {@link CriteriaElement} * - * @param bool $force - * @param bool $asObject + * @param bool $force + * @param bool $asObject * @return bool FALSE if deletion failed */ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null) diff --git a/class/Cloner.php b/class/Cloner.php index 98ba326b..a511d20d 100644 --- a/class/Cloner.php +++ b/class/Cloner.php @@ -10,7 +10,6 @@ class Cloner { // recursive cloning script - /** * @param $path */ @@ -39,7 +38,7 @@ public static function cloneFileFolder($path) } } else { $noChangeExtensions = ['jpeg', 'jpg', 'gif', 'png', 'zip', 'ttf']; - if (\in_array(mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions)) { + if (\in_array(mb_strtolower(\pathinfo($path, \PATHINFO_EXTENSION)), $noChangeExtensions, true)) { // image \copy($path, $newPath); } else { @@ -94,7 +93,7 @@ public static function createLogo($dirname) // Write text $textColor = \imagecolorallocate($imageModule, 0, 0, 0); - $spaceToBorder = intval((80 - mb_strlen($dirname) * 6.5) / 2); + $spaceToBorder = (int)((80 - mb_strlen($dirname) * 6.5) / 2); \imagefttext($imageModule, 8.5, 0, $spaceToBorder, 45, $textColor, $font, \ucfirst($dirname), []); // Set transparency color diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 9f8d49ab..8c8021b0 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -19,7 +19,6 @@ * @copyright XOOPS Project (https://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author lucio - * @package Publisher * * Example: * $breadcrumb = new Publisher\Common\Breadcrumb(); @@ -28,6 +27,7 @@ * $breadcrumb->addLink( 'bread 3', 'index3.php' ); * echo $breadcrumb->render(); */ + /** * Class Breadcrumb */ @@ -38,7 +38,7 @@ class Breadcrumb public function __construct() { - $this->dirname = \basename(\dirname(\dirname(__DIR__))); + $this->dirname = \basename(dirname(__DIR__, 2)); } /** @@ -56,21 +56,33 @@ public function addLink($title = '', $link = '') } /** - * Render Pedigree BreadCrumb + * Render BreadCrumb */ public function render() { + /* + TODO if you want to use the render code below, + 1) create ./templates/MODULENAME_common_breadcrumb.tpl) + 2) add declaration to xoops_version.php + */ + /* if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) { - require_once $GLOBALS['xoops']->path('class/theme.php'); + require $GLOBALS['xoops']->path('class/theme.php'); + $GLOBALS['xoTheme'] = new \xos_opal_Theme(); } - require_once $GLOBALS['xoops']->path('class/template.php'); + require $GLOBALS['xoops']->path('class/template.php'); + $breadcrumbTpl = new \XoopsTpl(); + $breadcrumbTpl->assign('breadcrumb', $this->bread); + $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); + unset($breadcrumbTpl); return $html; + */ } } diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 11e98006..9cf7d6ab 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -20,7 +20,6 @@ * @copyright XOOPS Project (https://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author XOOPS Development Team - * @package Publisher * @since 1.05 */ @@ -49,7 +48,7 @@ class Configurator */ public function __construct() { - $config = require \dirname(\dirname(__DIR__)) . '/config/config.php'; + $config = require dirname(__DIR__, 2) . '/config/config.php'; $this->name = $config->name; $this->uploadFolders = $config->uploadFolders; @@ -62,7 +61,7 @@ public function __construct() $this->moduleStats = $config->moduleStats; $this->modCopyright = $config->modCopyright; - $this->paths = require \dirname(\dirname(__DIR__)) . '/config/paths.php'; - $this->icons = require \dirname(\dirname(__DIR__)) . '/config/icons.php'; + $this->paths = require dirname(__DIR__, 2) . '/config/paths.php'; + $this->icons = require dirname(__DIR__, 2) . '/config/icons.php'; } } diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index bd7e7ed0..c98e7287 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -38,7 +38,7 @@ public static function createFolder($folder) file_put_contents($folder . '/index.html', ''); } - } catch (\Exception $e) { + } catch (\Throwable $e) { echo 'Caught exception: ', $e->getMessage(), '
    '; } } @@ -149,11 +149,8 @@ public static function deleteDirectory($src) if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { break; } - } else { - // delete the file - if (!($success = \unlink($fileInfo->getRealPath()))) { - break; - } + } elseif (!($success = \unlink($fileInfo->getRealPath()))) { + break; } } // now delete this (sub)directory if all the files are gone diff --git a/class/Common/Meta.php b/class/Common/Meta.php index 32314af0..dc6d5500 100644 --- a/class/Common/Meta.php +++ b/class/Common/Meta.php @@ -15,48 +15,52 @@ final class Meta { /** - * @param string $locale_code + * @param string $localeCode * @return string */ - public static function getStatik($locale_code) + + public static function getStatik($localeCode) { return ' - - - - - - - - '; + + + + + + + + '; } /** * @return string */ + public static function getRobot() { return ' - - - - '; + + + + '; } /** * @return string */ + public static function getNorobot() { return ' - - '; + + '; } /** * @param $title * @return string */ + public static function getTitle($title) { return '' . $title . ''; @@ -66,6 +70,7 @@ public static function getTitle($title) * @param $desc * @return string */ + public static function getDescription($desc) { return ''; @@ -75,34 +80,43 @@ public static function getDescription($desc) * @param $langList * @return string */ + public static function getAlternate($langList) { - $LL = ''; + $alternateLangList = ''; + if (\count($langList) > 1): foreach ($langList as $lang): - $LL .= ' - '; + $alternateLangList .= ' + '; endforeach; else: - $LL = ' - '; + $alternateLangList = ' + '; + endif; - return $LL; + + return $alternateLangList; } /** * @param $fb * @return string */ + public static function getFacebook($fb) { $fbh = ''; + if (\is_array($fb)): foreach ($fb as $fbkey => $fbrow): $fbh .= ' - '; + '; + endforeach; + endif; + return $fbh; } @@ -110,14 +124,19 @@ public static function getFacebook($fb) * @param $tw * @return string */ + public static function getTwitter($tw) { $twh = ''; + if (\is_array($tw)): foreach ($tw as $twkey => $twrow): $twh .= ''; + endforeach; + endif; + return $twh; } @@ -125,14 +144,19 @@ public static function getTwitter($tw) * @param $icon * @return string */ + public static function getIcon($icon) { $iconh = ''; + if (\is_array($icon)): foreach ($icon as $iconkey => $iconrow): $iconh .= ''; + endforeach; + endif; + return $iconh; } @@ -140,6 +164,7 @@ public static function getIcon($icon) * @param $author * @return string */ + public static function getAuthor($author) { return ''; @@ -149,6 +174,7 @@ public static function getAuthor($author) * @param $canonical * @return string */ + public static function getCanonical($canonical) { return ''; @@ -158,6 +184,7 @@ public static function getCanonical($canonical) * @param $manifest * @return string */ + public static function getManifest($manifest) { return ''; @@ -167,6 +194,7 @@ public static function getManifest($manifest) * @param $google * @return string */ + public static function getGoogle($google) { return ''; @@ -176,16 +204,18 @@ public static function getGoogle($google) * @param $bing * @return string */ + public static function getBing($bing) { return ' - '; + '; } /** * @param $yandex * @return string */ + public static function getgetYandex($yandex) { return ''; @@ -195,6 +225,7 @@ public static function getgetYandex($yandex) * @param $amp * @return string */ + public static function getAmp($amp) { return ''; @@ -204,32 +235,43 @@ public static function getAmp($amp) * @param $crumb * @return string */ + public static function getBreadcrumb($crumb) { - $h = ''; - $count = 0; + $h = ''; + + $count = 0; + $bcount = \count($crumb); + if (\is_array($crumb)): $h .= ''; + endif; + return $h; } } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 4987fcae..08928710 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -41,7 +41,7 @@ public function __construct() $configurator = new $class(); $this->renameTables = $configurator->renameTables; - $moduleDirName = \basename(\dirname(\dirname(__DIR__))); + $moduleDirName = \basename(dirname(__DIR__, 2)); parent::__construct($moduleDirName); } diff --git a/class/Common/ModuleFeedback.php b/class/Common/ModuleFeedback.php index 7fce8e9e..12b9d552 100644 --- a/class/Common/ModuleFeedback.php +++ b/class/Common/ModuleFeedback.php @@ -68,7 +68,7 @@ public function getFormFeedback($action = false) if (!$action) { $action = $_SERVER['REQUEST_URI']; } - $moduleDirName = \basename(\dirname(\dirname(__DIR__))); + $moduleDirName = \basename(dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); // Get Theme Form \xoops_load('XoopsFormLoader'); @@ -84,9 +84,9 @@ public function getFormFeedback($action = false) $your_site = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE'), 'your_site', 50, 255, $this->site); $your_site->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE_PLACEHOLER') . '"'); $form->addElement($your_site); - $your_mail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); - $your_mail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); - $form->addElement($your_mail); + $yourMail = new \XoopsFormText(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL'), 'your_mail', 50, 255, $this->email); + $yourMail->setExtra('placeholder="' . \constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL_PLACEHOLER') . '"'); + $form->addElement($yourMail); $fbtypeSelect = new \XoopsFormSelect(\constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE'), 'fb_type', $this->type); $fbtypeSelect->addOption('', ''); diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index ad32e7b3..6234fe98 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -17,6 +17,7 @@ trait ModuleStats * @param array $moduleStats * @return array */ + public static function getModuleStats($configurator, $moduleStats) { if (\count($configurator->moduleStats) > 0) { diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 6f84dd44..1b1d44d1 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -29,7 +29,7 @@ trait ServerStats public static function getServerStats() { //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); - $moduleDirName = \basename(\dirname(\dirname(__DIR__))); + $moduleDirName = \basename(dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); \xoops_loadLanguage('common', $moduleDirName); $html = ''; diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 3897ce3d..1e8ddaa0 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -2,7 +2,6 @@ declare(strict_types=1); -namespace XoopsModules\Publisher\Helper; namespace XoopsModules\Publisher\Common; /* @@ -19,10 +18,9 @@ */ /** - * * @license https://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2000-2020 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba */ @@ -30,6 +28,7 @@ use XoopsFormDhtmlTextArea; use XoopsFormTextArea; use XoopsModules\Publisher; +use XoopsModules\Publisher\Helper; /** * Class SysUtility @@ -74,58 +73,58 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } // splits all html-tags to scanable lines \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); - $total_length = mb_strlen($ending); - $open_tags = []; + $totalLength = mb_strlen($ending); + $openTags = []; $truncate = ''; - foreach ($lines as $line_matchings) { + foreach ($lines as $lineMatchings) { // if there is any html-tag in this line, handle it and add it (uncounted) to the output - if (!empty($line_matchings[1])) { + if (!empty($lineMatchings[1])) { // if it's an "empty element" with or without xhtml-conform closing slash - if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { + if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $lineMatchings[1])) { // do nothing // if tag is a closing tag - } elseif (\preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { - // delete tag from $open_tags list - $pos = \array_search($tag_matchings[1], $open_tags, true); + } elseif (\preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $lineMatchings[1], $tagMatchings)) { + // delete tag from $openTags list + $pos = \array_search($tagMatchings[1], $openTags, true); if (false !== $pos) { - unset($open_tags[$pos]); + unset($openTags[$pos]); } // if tag is an opening tag - } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { - // add tag to the beginning of $open_tags list - \array_unshift($open_tags, mb_strtolower($tag_matchings[1])); + } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $lineMatchings[1], $tagMatchings)) { + // add tag to the beginning of $openTags list + \array_unshift($openTags, mb_strtolower($tagMatchings[1])); } // add html-tag to $truncate'd text - $truncate .= $line_matchings[1]; + $truncate .= $lineMatchings[1]; } // calculate the length of the plain text part of the line; handle entities as one character - $content_length = mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); - if ($total_length + $content_length > $length) { + $content_length = mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $lineMatchings[2])); + if ($totalLength + $content_length > $length) { // the number of characters which are left - $left = $length - $total_length; - $entities_length = 0; + $left = $length - $totalLength; + $entitiesLength = 0; // search for html entities - if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { + if (\preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $lineMatchings[2], $entities, \PREG_OFFSET_CAPTURE)) { // calculate the real length of all entities in the legal range foreach ($entities[0] as $entity) { - if ($left >= $entity[1] + 1 - $entities_length) { + if ($left >= $entity[1] + 1 - $entitiesLength) { $left--; - $entities_length += mb_strlen($entity[0]); + $entitiesLength += mb_strlen($entity[0]); } else { // no more characters left break; } } } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); + $truncate .= mb_substr($lineMatchings[2], 0, $left + $entitiesLength); // maximum lenght is reached, so get off the loop break; } - $truncate .= $line_matchings[2]; - $total_length += $content_length; + $truncate .= $lineMatchings[2]; + $totalLength += $content_length; // if the maximum length is reached, get off the loop - if ($total_length >= $length) { + if ($totalLength >= $length) { break; } } @@ -148,7 +147,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac $truncate .= $ending; if ($considerHtml) { // close all unclosed html-tags - foreach ($open_tags as $tag) { + foreach ($openTags as $tag) { $truncate .= ''; } } @@ -157,8 +156,8 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } /** - * @param \Xmf\Module\Helper $helper - * @param array|null $options + * @param null|\Helper $helper + * @param array|null $options * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ public static function getEditor($helper = null, $options = null) diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index e028d5c8..d5a5d7ea 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -24,14 +24,14 @@ trait VersionChecks /** * Verifies XOOPS version meets minimum requirements for this module * @static - * @param \XoopsModule $module * - * @param null|string $requiredVer + * @param \XoopsModule|null $module + * @param null|string $requiredVer * @return bool true if meets requirements, false if not */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { - $moduleDirName = \basename(\dirname(\dirname(__DIR__))); + $moduleDirName = \basename(dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); @@ -63,7 +63,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = */ public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = \basename(\dirname(\dirname(__DIR__))); + $moduleDirName = \basename(dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); @@ -98,7 +98,7 @@ public static function checkVerPhp(\XoopsModule $module = null) */ public static function checkVerModule($helper, $source = 'github', $default = 'master') { - $moduleDirName = \basename(\dirname(\dirname(__DIR__))); + $moduleDirName = \basename(dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $update = ''; $repository = 'XoopsModules25x/' . $moduleDirName; diff --git a/class/Constants.php b/class/Constants.php index 37613f3f..2c57d5d8 100644 --- a/class/Constants.php +++ b/class/Constants.php @@ -17,13 +17,10 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Include * @since 1.0 * @author trabis */ - /** * interface Constants */ @@ -36,13 +33,11 @@ interface Constants public const PUBLISHER_STATUS_PUBLISHED = 2; public const PUBLISHER_STATUS_OFFLINE = 3; public const PUBLISHER_STATUS_REJECTED = 4; - // Notification Events public const PUBLISHER_NOT_CATEGORY_CREATED = 1; public const PUBLISHER_NOTIFY_ITEM_SUBMITTED = 2; public const PUBLISHER_NOTIFY_ITEM_PUBLISHED = 3; public const PUBLISHER_NOTIFY_ITEM_REJECTED = 4; - // Form constants public const PUBLISHER_SUMMARY = 1; //const PUBLISHER_DISPLAY_SUMMARY = 2; @@ -70,16 +65,13 @@ interface Constants public const PUBLISHER_SUBTITLE = 24; public const PUBLISHER_AUTHOR_ALIAS = 25; public const PUBLISHER_DATEEXPIRE = 26; - // Global constants public const PUBLISHER_SEARCH = 1; public const PUBLISHER_RATE = 2; - // File status public const PUBLISHER_STATUS_FILE_NOTSET = -1; public const PUBLISHER_STATUS_FILE_ACTIVE = 1; public const PUBLISHER_STATUS_FILE_INACTIVE = 2; - // Image categories public const PUBLISHER_IMGCAT_ALL = 'all'; } diff --git a/class/File.php b/class/File.php index 49ff49fc..7cc82290 100644 --- a/class/File.php +++ b/class/File.php @@ -17,15 +17,13 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory */ use XoopsModules\Publisher; - - +use XoopsModules\Publisher\Utility; require_once \dirname(__DIR__) . '/include/common.php'; @@ -49,9 +47,9 @@ class File extends \XoopsObject */ public function __construct($id = null) { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ + /** @var \XoopsModules\Publisher\Helper $this->helper */ $this->helper = \XoopsModules\Publisher\Helper::getInstance(); - /** @var \XoopsDatabase $db */ + /** @var \XoopsMySQLDatabase $db */ $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); $this->initVar('fileid', \XOBJ_DTYPE_INT, 0, false); $this->initVar('itemid', \XOBJ_DTYPE_INT, null, true); @@ -109,7 +107,7 @@ public function checkUpload($postField, $allowedMimetypes, &$errors) $maxfilewidth = $this->helper->getConfig('maximum_image_width'); $maxfileheight = $this->helper->getConfig('maximum_image_height'); \xoops_load('XoopsMediaUploader'); - $uploader = new \XoopsMediaUploader(Publisher\Utility::getUploadDir(), $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); + $uploader = new \XoopsMediaUploader(Utility::getUploadDir(), $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); if ($uploader->fetchMedia($postField)) { return true; } @@ -129,22 +127,22 @@ public function storeUpload($postField, $allowedMimetypes, &$errors) { /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimetypeHandler = $this->helper->getHandler('Mimetype'); - $itemid = $this->getVar('itemid'); + $itemId = $this->getVar('itemid'); if (0 === \count($allowedMimetypes)) { $allowedMimetypes = $mimetypeHandler->getArrayByType(); } $maxfilesize = $this->helper->getConfig('maximum_filesize'); $maxfilewidth = $this->helper->getConfig('maximum_image_width'); $maxfileheight = $this->helper->getConfig('maximum_image_height'); - if (!\is_dir(Publisher\Utility::getUploadDir())) { - if (!\mkdir($concurrentDirectory = Publisher\Utility::getUploadDir(), 0757) && !\is_dir($concurrentDirectory)) { + if (!\is_dir(Utility::getUploadDir())) { + if (!\mkdir($concurrentDirectory = Utility::getUploadDir(), 0757) && !\is_dir($concurrentDirectory)) { throw new \RuntimeException(\sprintf('Directory "%s" was not created', $concurrentDirectory)); } } \xoops_load('XoopsMediaUploader'); - $uploader = new \XoopsMediaUploader(Publisher\Utility::getUploadDir() . '/', $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); + $uploader = new \XoopsMediaUploader(Utility::getUploadDir() . '/', $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); if ($uploader->fetchMedia($postField)) { - $uploader->setTargetFileName($itemid . '_' . $uploader->getMediaName()); + $uploader->setTargetFileName($itemId . '_' . $uploader->getMediaName()); if ($uploader->upload()) { $this->setVar('filename', $uploader->getSavedFileName()); if ('' == $this->getVar('name')) { @@ -216,7 +214,7 @@ public function notLoaded() */ public function getFileUrl() { - return Publisher\Utility::getUploadDir(false) . $this->filename(); + return Utility::getUploadDir(false) . $this->filename(); } /** @@ -224,7 +222,7 @@ public function getFileUrl() */ public function getFilePath() { - return Publisher\Utility::getUploadDir() . $this->filename(); + return Utility::getUploadDir() . $this->filename(); } /** diff --git a/class/FileHandler.php b/class/FileHandler.php index 1fff5011..878783ed 100644 --- a/class/FileHandler.php +++ b/class/FileHandler.php @@ -17,7 +17,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -25,8 +24,6 @@ use XoopsModules\Publisher; - - require_once \dirname(__DIR__) . '/include/common.php'; // File status @@ -40,7 +37,6 @@ * of File class objects. * * @author marcan - * @package Publisher */ class FileHandler extends \XoopsPersistableObjectHandler { @@ -50,13 +46,9 @@ class FileHandler extends \XoopsPersistableObjectHandler */ public $helper; - /** - * @param \XoopsDatabase $db - * @param \XoopsModules\Publisher\Helper|null $helper - */ public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null) { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ + /** @var \XoopsModules\Publisher\Helper $this->helper */ if (null === $helper) { $this->helper = \XoopsModules\Publisher\Helper::getInstance(); } else { @@ -110,7 +102,7 @@ public function deleteItemFiles(\XoopsObject $itemObj) /** * retrieve all files * - * @param int $itemid + * @param int $itemId * @param int|array $status * @param int $limit * @param int $start @@ -120,7 +112,7 @@ public function deleteItemFiles(\XoopsObject $itemObj) * * @return array array of {@link File} objects */ - public function getAllFiles($itemid = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = []) + public function getAllFiles($itemId = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = []) { $files = []; @@ -151,9 +143,9 @@ public function getAllFiles($itemid = 0, $status = -1, $limit = 0, $start = 0, $ $criteriaCategory->add(new \Criteria('l.categoryid', $cat), 'OR'); } } - $criteriaItemid = new \Criteria('o.itemid', $itemid); + $criteriaItemid = new \Criteria('o.itemid', $itemId); $criteria = new \CriteriaCompo(); - if (0 != $itemid) { + if (0 != $itemId) { $criteria->add($criteriaItemid); } if ($hasStatusCriteria) { diff --git a/class/Form/CategoryForm.php b/class/Form/CategoryForm.php index 91ce84da..2eec7db4 100644 --- a/class/Form/CategoryForm.php +++ b/class/Form/CategoryForm.php @@ -19,15 +19,14 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ use Xmf\Request; use XoopsModules\Publisher; - - +use XoopsModules\Publisher\Helper; +use XoopsModules\Publisher\Utility; // require_once dirname(dirname(__DIR__)) . '/include/common.php'; @@ -43,11 +42,8 @@ class CategoryForm extends \XoopsThemeForm * @var Publisher\Helper */ public $helper; - public $targetObject; - public $subCatsCount = 4; - public $userGroups = []; /** @@ -56,8 +52,8 @@ class CategoryForm extends \XoopsThemeForm */ public function __construct(&$target, $subCatsCount = 4) { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ - $this->helper = \XoopsModules\Publisher\Helper::getInstance(); + /** @var \XoopsModules\Publisher\Helper $this->helper */ + $this->helper = Helper::getInstance(); $this->targetObject = &$target; $this->subCatsCount = $subCatsCount; @@ -82,7 +78,7 @@ public function createElements() $myTree = new \XoopsObjectTree($this->helper->getHandler('Category')->getObjects($criteria), 'categoryid', 'parentid'); $moduleDirName = \basename(\dirname(__DIR__)); $module = \XoopsModule::getByDirname($moduleDirName); - if (Publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { + if (Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { $catSelect = $myTree->makeSelectElement('parentid', 'name', '--', $this->targetObject->parentid(), true, 0, '', \_AM_PUBLISHER_PARENT_CATEGORY_EXP); $this->addElement($catSelect); } else { @@ -100,19 +96,19 @@ public function createElements() $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; $grouppermHandler = $this->helper->getHandler('GroupPerm'); $moduleId = $this->helper->getModule()->mid(); - $allowedEditors = Publisher\Utility::getEditors($grouppermHandler->getItemIds('editors', $groups, $moduleId)); + $allowedEditors = Utility::getEditors($grouppermHandler->getItemIds('editors', $groups, $moduleId)); $nohtml = false; if (\count($allowedEditors) > 0) { $editor = Request::getString('editor', '', 'POST'); if (!empty($editor)) { - Publisher\Utility::setCookieVar('publisher_editor', $editor); + Utility::setCookieVar('publisher_editor', $editor); } else { - $editor = Publisher\Utility::getCookieVar('publisher_editor'); + $editor = Utility::getCookieVar('publisher_editor'); if (empty($editor) && \is_object($GLOBALS['xoopsUser'])) { $editor = $GLOBALS['xoopsUser']->getVar('publisher_editor') ?? ''; // Need set through user profile } } - $editor = (empty($editor) || !\in_array($editor, $allowedEditors)) ? $this->helper->getConfig('submit_editor') : $editor; + $editor = (empty($editor) || !\in_array($editor, $allowedEditors, true)) ? $this->helper->getConfig('submit_editor') : $editor; $formEditor = new \XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors); $this->addElement($formEditor); } else { @@ -133,20 +129,20 @@ public function createElements() $this->addElement($textHeader); // IMAGE - $imageArray = \XoopsLists::getImgListAsArray(Publisher\Utility::getImageDir('category')); + $imageArray = \XoopsLists::getImgListAsArray(Utility::getImageDir('category')); $imageSelect = new \XoopsFormSelect('', 'image', $this->targetObject->getImage()); //$imageSelect -> addOption ('-1', '---------------'); $imageSelect->addOptionArray($imageArray); $imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . '", "", "' . XOOPS_URL . "\")'"); $imageTray = new \XoopsFormElementTray(\_AM_PUBLISHER_IMAGE, ' '); $imageTray->addElement($imageSelect); - $imageTray->addElement(new \XoopsFormLabel('', "

    targetObject->getImage() . "' name='image3' id='image3' alt=''>")); + $imageTray->addElement(new \XoopsFormLabel('', "

    targetObject->getImage() . "' name='image3' id='image3' alt=''>")); $imageTray->setDescription(\_AM_PUBLISHER_IMAGE_DSC); $this->addElement($imageTray); // IMAGE UPLOAD - $max_size = 5000000; - $fileBox = new \XoopsFormFile(\_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $max_size); + $maxSize = 5000000; + $fileBox = new \XoopsFormFile(\_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $maxSize); $fileBox->setExtra("size ='45'"); $fileBox->setDescription(\_AM_PUBLISHER_IMAGE_UPLOAD_DSC); $this->addElement($fileBox); @@ -183,8 +179,8 @@ public function createElements() $groupsReadCheckbox = new \XoopsFormCheckBox('', 'groupsRead[]', $this->targetObject->getGroupsRead()); - foreach ($this->userGroups as $group_id => $group_name) { - $groupsReadCheckbox->addOption($group_id, $group_name); + foreach ($this->userGroups as $groupId => $groupName) { + $groupsReadCheckbox->addOption($groupId, $groupName); } $readPermissionsTray->addElement($groupsReadCheckbox); $this->addElement($readPermissionsTray); @@ -200,8 +196,8 @@ public function createElements() $submitPermissionsTray->addElement($selectAllSubmitCheckbox); $groupsSubmitCheckbox = new \XoopsFormCheckBox('', 'groupsSubmit[]', $this->targetObject->getGroupsSubmit()); - foreach ($this->userGroups as $group_id => $group_name) { - $groupsSubmitCheckbox->addOption($group_id, $group_name); + foreach ($this->userGroups as $groupId => $groupName) { + $groupsSubmitCheckbox->addOption($groupId, $groupName); } $submitPermissionsTray->addElement($groupsSubmitCheckbox); $this->addElement($submitPermissionsTray); @@ -218,8 +214,8 @@ public function createElements() $groupsModerationCheckbox = new \XoopsFormCheckBox('', 'groupsModeration[]', $this->targetObject->getGroupsModeration()); - foreach ($this->userGroups as $group_id => $group_name) { - $groupsModerationCheckbox->addOption($group_id, $group_name); + foreach ($this->userGroups as $groupId => $groupName) { + $groupsModerationCheckbox->addOption($groupId, $groupName); } $moderatePermissionsTray->addElement($groupsModerationCheckbox); $this->addElement($moderatePermissionsTray); diff --git a/class/Form/FileForm.php b/class/Form/FileForm.php index 31ca0f5c..366fa853 100644 --- a/class/Form/FileForm.php +++ b/class/Form/FileForm.php @@ -19,7 +19,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ @@ -27,14 +26,11 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; \xoops_load('XoopsFormLoader'); //todo: move to admin? //xoops_loadLanguage('main', 'publisher'); -/** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); $helper->loadLanguage('main'); @@ -47,15 +43,15 @@ class FileForm extends \XoopsThemeForm * @var Publisher\Helper */ public $helper; - public $targetObject; /** + * FileForm constructor. * @param $target */ public function __construct(&$target) { - /** @var Publisher\Helper $this ->helper */ + /** @var Publisher\Helper $this->helper */ $this->helper = Publisher\Helper::getInstance(); $this->targetObject = &$target; diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php index 99726769..37acd5df 100644 --- a/class/Form/ItemForm.php +++ b/class/Form/ItemForm.php @@ -19,8 +19,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Class - * @subpackage Forms * @since 1.0 * @author trabis */ @@ -28,8 +26,8 @@ use Xmf\Request; use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - +use XoopsModules\Publisher\Helper; +use XoopsModules\Publisher\Utility; // require_once dirname(dirname(__DIR__)) . '/include/common.php'; @@ -51,7 +49,6 @@ class ItemForm extends Publisher\ThemeTabForm \_CO_PUBLISHER_TAB_FILES => 'filesTab', \_CO_PUBLISHER_TAB_OTHERS => 'othersTab', ]; - public $mainTab = [ Constants::PUBLISHER_SUBTITLE, Constants::PUBLISHER_ITEM_SHORT_URL, @@ -69,15 +66,12 @@ class ItemForm extends Publisher\ThemeTabForm Constants::PUBLISHER_AVAILABLE_PAGE_WRAP, Constants::PUBLISHER_UID, ]; - public $imagesTab = [ Constants::PUBLISHER_IMAGE_ITEM, ]; - public $filesTab = [ Constants::PUBLISHER_ITEM_UPLOAD_FILE, ]; - public $othersTab = [ Constants::PUBLISHER_ITEM_META_KEYWORDS, Constants::PUBLISHER_ITEM_META_DESCRIPTION, @@ -100,8 +94,7 @@ public function setCheckPermissions($checkperm) */ public function isGranted($item) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); $ret = false; if (!$this->checkperm || $helper->getHandler('Permission')->isGranted('form_view', $item)) { $ret = true; @@ -139,15 +132,14 @@ public function hasTab($tab) */ public function createElements($obj) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); + $timeoffset = null; - $allowedEditors = Publisher\Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors')); + $allowedEditors = Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors')); if (!\is_object($GLOBALS['xoopsUser'])) { $group = [XOOPS_GROUP_ANONYMOUS]; $currentUid = 0; - $timeoffset = null; } else { $group = $GLOBALS['xoopsUser']->getGroups(); $currentUid = $GLOBALS['xoopsUser']->uid(); @@ -184,7 +176,6 @@ public function createElements($obj) require_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php'); $textTags = new \XoopsModules\Tag\FormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0); $textTags->setClass('form-control'); - /** @var \XoopsModules\Tag\FormTag $textTags */ $this->addElement($textTags); } @@ -195,15 +186,15 @@ public function createElements($obj) } elseif (\count($allowedEditors) > 0) { $editor = Request::getString('editor', '', 'POST'); if (!empty($editor)) { - Publisher\Utility::setCookieVar('publisher_editor', $editor); + Utility::setCookieVar('publisher_editor', $editor); } else { - $editor = Publisher\Utility::getCookieVar('publisher_editor'); + $editor = Utility::getCookieVar('publisher_editor'); if (empty($editor) && \is_object($GLOBALS['xoopsUser'])) { // $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile $editor = $GLOBALS['xoopsUser']->getVar('publisher_editor') ?? ''; // Need set through user profile } } - $editor = (empty($editor) || !\in_array($editor, $allowedEditors)) ? $helper->getConfig('submit_editor') : $editor; + $editor = (empty($editor) || !\in_array($editor, $allowedEditors, true)) ? $helper->getConfig('submit_editor') : $editor; $formEditor = new \XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors); $this->addElement($formEditor); @@ -242,8 +233,8 @@ public function createElements($obj) || $this->isGranted(Constants::PUBLISHER_DOIMAGE) || $this->isGranted(Constants::PUBLISHER_DOLINEBREAK)) { if ($this->isGranted(Constants::PUBLISHER_DOHTML)) { - $html_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO); - $this->addElement($html_radio); + $htmlRadio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO); + $this->addElement($htmlRadio); } if ($this->isGranted(Constants::PUBLISHER_DOSMILEY)) { $smiley_radio = new \XoopsFormRadioYN(\_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO); @@ -265,7 +256,7 @@ public function createElements($obj) // Available pages to wrap if ($this->isGranted(Constants::PUBLISHER_AVAILABLE_PAGE_WRAP)) { - $wrapPages = \XoopsLists::getHtmlListAsArray(Publisher\Utility::getUploadDir(true, 'content')); + $wrapPages = \XoopsLists::getHtmlListAsArray(Utility::getUploadDir(true, 'content')); $availableWrapPagesText = []; foreach ($wrapPages as $page) { $availableWrapPagesText[] = "$page"; @@ -350,18 +341,16 @@ public function createElements($obj) if ($obj->isNew()) { $dateexpire = \time(); $dateexpire_opt = 0; + } elseif (0 == $obj->getVar('dateexpire')) { + $dateexpire_opt = 0; + $dateexpire = \time(); } else { - if (0 == $obj->getVar('dateexpire')) { - $dateexpire_opt = 0; - $dateexpire = \time(); - } else { - $dateexpire_opt = 1; - $dateexpire = $obj->getVar('dateexpire'); - } + $dateexpire_opt = 1; + $dateexpire = $obj->getVar('dateexpire'); } $dateExpireYesNo = new \XoopsFormRadioYN('', 'use_expire_yn', $dateexpire_opt); - $dateexpire = formatTimestamp($dateexpire, 'U', $timeoffset); + $dateexpire = \strtotime(\formatTimestamp($dateexpire)); //set to user timezone $dateexpire_datetime = new \XoopsFormDateTime('', 'dateexpire', $size = 15, $dateexpire, true); if (0 == $dateexpire_opt) { $dateexpire_datetime->setExtra('disabled="disabled"'); @@ -401,7 +390,7 @@ public function createElements($obj) $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1); } $imgcatConfig = $helper->getConfig('submit_imgcat'); - if (\in_array(Constants::PUBLISHER_IMGCAT_ALL, $imgcatConfig)) { + if (\in_array(Constants::PUBLISHER_IMGCAT_ALL, $imgcatConfig, true)) { $catids = \array_keys($catlist); } else { // compare selected in options with readable of user diff --git a/class/FormDateTime.php b/class/FormDateTime.php index f557f9c4..888409c4 100644 --- a/class/FormDateTime.php +++ b/class/FormDateTime.php @@ -18,12 +18,9 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ - - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -49,7 +46,7 @@ public function __construct($caption, $name, $size = 15, $value = 0, $showtime = } $datetime = \getdate($value); - $this->addElement(new \XoopsFormTextDateSelect('', $name . '[date]', $size, $value, $showtime)); + $this->addElement(new \XoopsFormTextDateSelect('', $name . '[date]', $size, $value)); $timearray = []; for ($i = 0; $i < 24; ++$i) { for ($j = 0; $j < 60; $j += 10) { diff --git a/class/GroupPermHandler.php b/class/GroupPermHandler.php index c1aefa72..8c55710f 100644 --- a/class/GroupPermHandler.php +++ b/class/GroupPermHandler.php @@ -19,13 +19,9 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ - - - require_once $GLOBALS['xoops']->path('kernel/groupperm.php'); require_once \dirname(__DIR__) . '/include/common.php'; diff --git a/class/Helper.php b/class/Helper.php index 11ba5d01..1acbe295 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -18,8 +18,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Class - * @subpackage Utils * @since 1.0 * @author trabis */ @@ -89,6 +87,7 @@ public function getHandler($name) $helper = self::getInstance(); $ret = new $class($db, $helper); $this->addLog("Getting handler '{$name}'"); + return $ret; } } diff --git a/class/Highlighter.php b/class/Highlighter.php index d8a6fdac..1a771b9d 100644 --- a/class/Highlighter.php +++ b/class/Highlighter.php @@ -31,7 +31,6 @@ class Highlighter * @var bool */ protected $simple = false; - /** * Only match whole words in the string * (off by default) @@ -39,7 +38,6 @@ class Highlighter * @var bool */ protected $wholeWords = false; - /** * Case sensitive matching * (off by default) @@ -47,14 +45,12 @@ class Highlighter * @var bool */ protected $caseSens = false; - /** * Overwrite links if matched * This should be used when the replacement string is a link * (off by default) */ protected $stripLinks = false; - /** * Style for the output string * @@ -108,7 +104,7 @@ public function setReplacementString($value) * @param string $text Haystack - The text to search * @param array|string $needle Needle - The string to highlight * - * @return string $text with needle highlighted + * @return string $text (with needle highlighted) */ public function highlight($text, $needle) { diff --git a/class/Item.php b/class/Item.php index 9a4ced19..7a4159ea 100644 --- a/class/Item.php +++ b/class/Item.php @@ -17,7 +17,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -25,10 +24,10 @@ use Xmf\Request; use XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; //namespace Publisher; - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -41,7 +40,6 @@ class Item extends \XoopsObject */ public $helper; public $groupsRead = []; - /** * @var Publisher\Category */ @@ -54,8 +52,8 @@ public function __construct($id = null) { /** @var \XoopsModules\Publisher\Helper $this->helper */ $this->helper = \XoopsModules\Publisher\Helper::getInstance(); - /** @var \XoopsDatabase $this->db */ - $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); + /** @var \XoopsMySQLDatabase $this->db */ + $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); $this->initVar('itemid', \XOBJ_DTYPE_INT, 0); $this->initVar('categoryid', \XOBJ_DTYPE_INT, 0, false); $this->initVar('title', \XOBJ_DTYPE_TXTBOX, '', true, 255); @@ -132,7 +130,7 @@ public function getTitle($maxLength = 0, $format = 'S') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (mb_strlen($ret) >= $maxLength) { - $ret = Publisher\Utility::substr($ret, 0, $maxLength); + $ret = Utility::substr($ret, 0, $maxLength); } } } @@ -152,7 +150,7 @@ public function getSubtitle($maxLength = 0, $format = 'S') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (mb_strlen($ret) >= $maxLength) { - $ret = Publisher\Utility::substr($ret, 0, $maxLength); + $ret = Utility::substr($ret, 0, $maxLength); } } } @@ -176,9 +174,9 @@ public function getSummary($maxLength = 0, $format = 'S', $stripTags = '') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (mb_strlen($ret) >= $maxLength) { - //$ret = Publisher\Utility::substr($ret , 0, $maxLength); - // $ret = Publisher\Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); - $ret = Publisher\Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false); + //$ret = Utility::substr($ret , 0, $maxLength); + // $ret = Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); + $ret = Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false); } } } @@ -215,7 +213,7 @@ public function getBlockSummary($maxLength = 0, $fullSummary = false) public function wrapPage($fileName) { $content = ''; - $page = Publisher\Utility::getUploadDir(true, 'content') . $fileName; + $page = Utility::getUploadDir(true, 'content') . $fileName; if (\file_exists($page)) { // this page uses smarty template \ob_start(); @@ -256,8 +254,8 @@ public function getBody($maxLength = 0, $format = 'S', $stripTags = '') while (!(false === $wrapPos)) { $endWrapPos = mb_strpos($ret, ']', $wrapPos); if ($endWrapPos) { - $wrap_page_name = mb_substr($ret, $wrapPos + $wrapCodeLength, $endWrapPos - $wrapCodeLength - $wrapPos); - $wrapPages[] = $wrap_page_name; + $wrapPagename = mb_substr($ret, $wrapPos + $wrapCodeLength, $endWrapPos - $wrapCodeLength - $wrapPos); + $wrapPages[] = $wrapPagename; } $wrapPos = mb_strpos($ret, '[pagewrap=', $endWrapPos - 1); } @@ -278,8 +276,8 @@ public function getBody($maxLength = 0, $format = 'S', $stripTags = '') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (mb_strlen($ret) >= $maxLength) { - //$ret = Publisher\Utility::substr($ret , 0, $maxLength); - $ret = Publisher\Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false); + //$ret = Utility::substr($ret , 0, $maxLength); + $ret = Utility::truncateHtml($ret, $maxLength, $etc = '...', $breakWords = false); } } } @@ -319,7 +317,7 @@ public function getDateExpire($dateFormat = '', $format = 'S') return \formatTimestamp($this->getVar('dateexpire', $format), $dateFormat); } - + /** * @param int $realName * @@ -444,7 +442,7 @@ public function getCategoryPath($withAllLink = true) */ public function getCategoryImagePath() { - return Publisher\Utility::getImageDir('category', false) . $this->getCategory()->getImage(); + return Utility::getImageDir('category', false) . $this->getCategory()->getImage(); } /** @@ -462,21 +460,21 @@ public function getAdminLinks() { $adminLinks = ''; if (\is_object($GLOBALS['xoopsUser']) - && (Publisher\Utility::userIsAdmin() || Publisher\Utility::userIsAuthor($this) + && (Utility::userIsAdmin() || Utility::userIsAuthor($this) || $this->helper->getHandler('Permission')->isGranted('item_submit', $this->categoryid()))) { - if (Publisher\Utility::userIsAdmin() || Publisher\Utility::userIsAuthor($this) || Publisher\Utility::userIsModerator($this)) { - if ($this->helper->getConfig('perm_edit') || Publisher\Utility::userIsModerator($this) || Publisher\Utility::userIsAdmin()) { + if (Utility::userIsAdmin() || Utility::userIsAuthor($this) || Utility::userIsModerator($this)) { + if ($this->helper->getConfig('perm_edit') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Edit button $adminLinks .= "" . \_CO_PUBLISHER_EDIT . ""; $adminLinks .= ' '; } - if ($this->helper->getConfig('perm_delete') || Publisher\Utility::userIsModerator($this) || Publisher\Utility::userIsAdmin()) { + if ($this->helper->getConfig('perm_delete') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Delete button $adminLinks .= "itemid() . "'>" . \_CO_PUBLISHER_DELETE . ""; $adminLinks .= ' '; } } - if ($this->helper->getConfig('perm_clone') || Publisher\Utility::userIsModerator($this) || Publisher\Utility::userIsAdmin()) { + if ($this->helper->getConfig('perm_clone') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Duplicate button $adminLinks .= "itemid() . "'>" . \_CO_PUBLISHER_CLONE . ""; $adminLinks .= ' '; @@ -485,41 +483,43 @@ public function getAdminLinks() return $adminLinks; } - - /** + + /** * @return string */ public function getPdfButton() { - $pdfButton = ''; + $pdfButton = ''; // PDF button - if (!\is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { - // if (is_object($GLOBALS['xoopsUser']) && Publisher\Utility::userIsAdmin()) { - // $GLOBALS['xoTheme']->addStylesheet('/modules/system/css/jquery.jgrowl.min.css'); - // $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js'); - // $adminLinks .= ''; - // } - } else { - $pdfButton .= "" . \_CO_PUBLISHER_PDF . " "; - $pdfButton .= ' '; - } - return $pdfButton; + if (!\is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { + // if (is_object($GLOBALS['xoopsUser']) && Utility::userIsAdmin()) { + // $GLOBALS['xoTheme']->addStylesheet('/modules/system/css/jquery.jgrowl.min.css'); + // $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js'); + // $adminLinks .= ''; + // } + } else { + $pdfButton .= "" . \_CO_PUBLISHER_PDF . " "; + $pdfButton .= ' '; } - /** + return $pdfButton; + } + + /** * @return string */ public function getPrintLinks() { - $printLinks = ''; + $printLinks = ''; // Print button $printLinks .= "itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'>" . \_CO_PUBLISHER_PRINT . " "; $printLinks .= ' '; + return $printLinks; } @@ -569,7 +569,7 @@ public function setDefaultPermissions() { $memberHandler = \xoops_getHandler('member'); $groups = $memberHandler->getGroupList(); - $groupIds = 0 < \count($groups) ? \array_keys($groups) : []; + $groupIds = \count($groups) > 0 ? \array_keys($groups) : []; /* $j = 0; $groupIds = []; @@ -718,10 +718,10 @@ public function buildMainText($itemPageId = -1, $body = null) public function getImages() { static $ret; - $itemid = $this->getVar('itemid'); - if (!isset($ret[$itemid])) { - $ret[$itemid]['main'] = ''; - $ret[$itemid]['others'] = []; + $itemId = $this->getVar('itemid'); + if (!isset($ret[$itemId])) { + $ret[$itemId]['main'] = ''; + $ret[$itemId]['others'] = []; $imagesIds = []; $image = $this->getVar('image'); $images = $this->getVar('images'); @@ -740,16 +740,16 @@ public function getImages() } foreach ($imageObjs as $id => $imageObj) { if ($id == $image) { - $ret[$itemid]['main'] = $imageObj; + $ret[$itemId]['main'] = $imageObj; } else { - $ret[$itemid]['others'][] = $imageObj; + $ret[$itemId]['others'][] = $imageObj; } unset($imageObj); } unset($imageObjs); } - return $ret[$itemid]; + return $ret[$itemId]; } /** @@ -767,50 +767,50 @@ public function toArraySimple($display = 'default', $maxCharTitle = 0, $maxCharS $itemPageId = $display; $display = 'all'; } - $item['itemid'] = $this->itemid(); - $item['uid'] = $this->uid(); - $item['itemurl'] = $this->getItemUrl(); - $item['titlelink'] = $this->getItemLink('titlelink', $maxCharTitle); - $item['subtitle'] = $this->subtitle(); - $item['datesub'] = $this->getDatesub(); - $item['dateexpire'] = $this->getDateExpire(); - $item['counter'] = $this->counter(); - $item['hits'] = ' ' . $this->counter() . ' ' . _READS . ''; - $item['who'] = $this->getWho(); - $item['when'] = $this->getWhen(); - $item['category'] = $this->getCategoryName(); - $item['categorylink'] = $this->getCategoryLink(); - $item['cancomment'] = $this->cancomment(); - $comments = $this->comments(); - if ($comments > 0) { - //shows 1 comment instead of 1 comm. if comments ==1 - //langugage file modified accordingly - if (1 == $comments) { - $item['comments'] = ' ' . \_MD_PUBLISHER_ONECOMMENT . ' '; - } else { - $item['comments'] = ' ' . $comments . ' ' . \_MD_PUBLISHER_COMMENTS . ' '; - } + $item['itemid'] = $this->itemid(); + $item['uid'] = $this->uid(); + $item['itemurl'] = $this->getItemUrl(); + $item['titlelink'] = $this->getItemLink('titlelink', $maxCharTitle); + $item['subtitle'] = $this->subtitle(); + $item['datesub'] = $this->getDatesub(); + $item['dateexpire'] = $this->getDateExpire(); + $item['counter'] = $this->counter(); + $item['hits'] = ' ' . $this->counter() . ' ' . _READS . ''; + $item['who'] = $this->getWho(); + $item['when'] = $this->getWhen(); + $item['category'] = $this->getCategoryName(); + $item['categorylink'] = $this->getCategoryLink(); + $item['cancomment'] = $this->cancomment(); + $comments = $this->comments(); + if ($comments > 0) { + //shows 1 comment instead of 1 comm. if comments ==1 + //langugage file modified accordingly + if (1 == $comments) { + $item['comments'] = ' ' . \_MD_PUBLISHER_ONECOMMENT . ' '; } else { - $item['comments'] = ' ' . \_MD_PUBLISHER_NO_COMMENTS . ' '; + $item['comments'] = ' ' . $comments . ' ' . \_MD_PUBLISHER_COMMENTS . ' '; } - $item = $this->getMainImage($item); + } else { + $item['comments'] = ' ' . \_MD_PUBLISHER_NO_COMMENTS . ' '; + } + $item = $this->getMainImage($item); switch ($display) { case 'summary': - $item = $this->toArrayFull($item); + $item = $this->toArrayFull($item); $item = $this->toArrayAll($item, $itemPageId); case 'list': - $item = $this->toArrayFull($item); + $item = $this->toArrayFull($item); $item = $this->toArrayAll($item, $itemPageId); - //break; + //break; case 'full': - $item = $this->toArrayFull($item); + $item = $this->toArrayFull($item); $item = $this->toArrayAll($item, $itemPageId); case 'wfsection': - $item = $this->toArrayFull($item); + $item = $this->toArrayFull($item); $item = $this->toArrayAll($item, $itemPageId); case 'default': - $item = $this->toArrayFull($item); - $item = $this->toArrayAll($item, $itemPageId); + $item = $this->toArrayFull($item); + $item = $this->toArrayAll($item, $itemPageId); $summary = $this->getSummary($maxCharSummary); if (!$summary) { $summary = $this->getBody($maxCharSummary); @@ -847,20 +847,20 @@ public function toArraySimple($display = 'default', $maxCharTitle = 0, $maxCharS */ public function toArrayFull($item) { - $item['title'] = $this->getTitle(); - $item['clean_title'] = $this->getTitle(); - $item['itemurl'] = $this->getItemUrl(); - + $item['title'] = $this->getTitle(); + $item['clean_title'] = $this->getTitle(); + $item['itemurl'] = $this->getItemUrl(); + $item['adminlink'] = $this->getAdminLinks(); - $item['pdfbutton'] = $this->getPdfButton(); - $item['printlink'] = $this->getPrintLinks(); + $item['pdfbutton'] = $this->getPdfButton(); + $item['printlink'] = $this->getPrintLinks(); $item['categoryPath'] = $this->getCategoryPath($this->helper->getConfig('format_linked_path')); $item['who_when'] = $this->getWhoAndWhen(); $item['who'] = $this->getWho(); $item['when'] = $this->getWhen(); $item['category'] = $this->getCategoryName(); - $item['body'] = $this->getBody(); - $item['more'] = $this->getItemUrl(); + $item['body'] = $this->getBody(); + $item['more'] = $this->getItemUrl(); $item = $this->getMainImage($item); return $item; @@ -1028,7 +1028,7 @@ public function getForm($title = 'default', $checkperm = true) */ public function accessGranted() { - if (Publisher\Utility::userIsAdmin()) { + if (Utility::userIsAdmin()) { return true; } if (Constants::PUBLISHER_STATUS_PUBLISHED != $this->getVar('status')) { @@ -1048,11 +1048,11 @@ 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{ + } else { $userTimeoffset = null; } $this->setVar('categoryid', Request::getInt('categoryid', 0, 'POST')); @@ -1079,7 +1079,7 @@ public function setVarsFromRequest() if ($imageName == $imageFeatured) { $this->setVar('image', $id); } - if (\in_array($imageName, $imageItem)) { + if (\in_array($imageName, $imageItem, true)) { $imageItemIds[] = $id; } } @@ -1103,8 +1103,8 @@ public function setVarsFromRequest() // if (version_compare(PHP_VERSION, '5.4.0') >= 0) { // $this->setVar('datesub', strtotime(Request::getArray('datesub', array(), 'POST')['date']) + Request::getArray('datesub', array(), 'POST')['time']); // } else { - $resDate = Request::getArray('datesub', [], 'POST'); - $resTime = Request::getArray('datesub', [], 'POST'); + $resDate = Request::getArray('datesub', [], 'POST'); + $resTime = Request::getArray('datesub', [], 'POST'); $dateTimeObj = \DateTime::createFromFormat(_SHORTDATESTRING, $resDate['date']); $dateTimeObj->setTime(0, 0, (int)$resTime['time']); $serverTimestamp = userTimeToServerTime($dateTimeObj->getTimestamp(), $userTimeoffset); @@ -1113,12 +1113,12 @@ public function setVarsFromRequest() } elseif ($this->isNew()) { $this->setVar('datesub', \time()); } - + // date expire if (0 !== Request::getInt('use_expire_yn', 0, 'POST')) { if ('' !== Request::getString('dateexpire', '', 'POST')) { - $resExDate = Request::getArray('dateexpire', [], 'POST'); - $resExTime = Request::getArray('dateexpire', [], 'POST'); + $resExDate = Request::getArray('dateexpire', [], 'POST'); + $resExTime = Request::getArray('dateexpire', [], 'POST'); $dateTimeObj = \DateTime::createFromFormat(_SHORTDATESTRING, $resExDate['date']); $dateTimeObj->setTime(0, 0, (int)$resExTime['time']); $serverTimestamp = userTimeToServerTime($dateTimeObj->getTimestamp(), $userTimeoffset); diff --git a/class/ItemHandler.php b/class/ItemHandler.php index 7a85d384..2ae614f4 100644 --- a/class/ItemHandler.php +++ b/class/ItemHandler.php @@ -17,7 +17,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -25,7 +24,6 @@ use XoopsModules\Publisher; - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -34,25 +32,19 @@ * of Q&A class objects. * * @author marcan - * @package Publisher */ class ItemHandler extends \XoopsPersistableObjectHandler { /** * @var Publisher\Helper */ - public $helper; - public $publisherIsAdmin; - + public $helper; + public $publisherIsAdmin; protected $resultCatCounts = []; - /** - * @param \XoopsDatabase $db - * @param \XoopsModules\Publisher\Helper|null $helper - */ public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null) { - /** @var Publisher\Helper $this ->helper */ + /** @var Publisher\Helper $this->helper */ if (null === $helper) { $this->helper = \XoopsModules\Publisher\Helper::getInstance(); } else { @@ -82,11 +74,11 @@ public function create($isNew = true) /** * retrieve an item * - * @param int $id itemid of the user + * @param null|int $id itemid of the user * - * @param null $fields + * @param array|null $fields * @return mixed reference to the Item object, FALSE if failed - * object, FALSE if failed + * object, FALSE if failed */ public function get($id = null, $fields = null) { @@ -168,13 +160,12 @@ public function delete(\XoopsObject $item, $force = false) /** * retrieve items from the database * - * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement} + * @param \CriteriaElement|null $criteria {@link CriteriaElement} * conditions to be met - * @param bool|string $idKey what shall we use as array key ? none, itemid, categoryid - * @param bool $as_object - * @param string|bool $notNullFields + * @param bool|string $idKey what shall we use as array key ? none, itemid, categoryid + * @param bool $as_object + * @param string|null $notNullFields * @return array array of Item objects - * objects */ public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null) { @@ -230,14 +221,15 @@ public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', /** * count items matching a condition * - * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement} + * @param \CriteriaElement|null $criteria {@link CriteriaElement} * to match - * @param string $notNullFields + * @param string|null $notNullFields * * @return int count of items */ - public function getCount(\CriteriaElement $criteria = null, $notNullFields = '') + public function getCount(\CriteriaElement $criteria = null, $notNullFields = null) { + $notNullFields = (null !== $notNullFields) ?: ''; $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix($this->helper->getDirname() . '_items'); if (null !== $criteria && $criteria instanceof \CriteriaElement) { $whereClause = $criteria->renderWhere(); @@ -262,14 +254,15 @@ public function getCount(\CriteriaElement $criteria = null, $notNullFields = '') } /** - * @param int $categoryid + * @param int $categoryId * @param string|array $status - * @param string $notNullFields + * @param string|null $notNullFields * @param null|\CriteriaCompo $criteriaPermissions * @return \CriteriaCompo */ - private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = '', $criteriaPermissions = null) + private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields = null, $criteriaPermissions = null) { + // $notNullFields = (null !== $notNullFields) ?: ''; // global $publisherIsAdmin; // $ret = 0; // if (!$publisherIsAdmin) { @@ -284,8 +277,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(); if (!empty($status) && \is_array($status)) { @@ -310,14 +303,15 @@ private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields } /** - * @param $categoryid - * @param string $status - * @param string $notNullFields + * @param $categoryId + * @param string $status + * @param string|null $notNullFields * * @return int */ - public function getItemsCount($categoryid = -1, $status = '', $notNullFields = '') + public function getItemsCount($categoryId = -1, $status = '', $notNullFields = null) { + $notNullFields = (null !== $notNullFields) ?: ''; $criteriaPermissions = null; if (!$this->publisherIsAdmin) { $criteriaPermissions = new \CriteriaCompo(); @@ -331,11 +325,11 @@ public function getItemsCount($categoryid = -1, $status = '', $notNullFields = ' } } // $ret = []; - $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)) { @@ -364,18 +358,19 @@ public function getItemsCount($categoryid = -1, $status = '', $notNullFields = ' /** * @param int $limit * @param int $start - * @param int $categoryid + * @param int $categoryId * @param string $sort * @param string $order - * @param string $notNullFields + * @param string|null $notNullFields * @param bool $asObject * @param string $idKey * @param bool $excludeExpired * * @return array */ - public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $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(); if (!$this->publisherIsAdmin) { $criteriaDateSub = new \Criteria('datesub', \time(), '<='); @@ -389,28 +384,29 @@ 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 string $sort - * @param string $order - * @param string $notNullFields - * @param bool $asObject - * @param string $idKey + * @param int $limit + * @param int $start + * @param int $categoryId + * @param string $sort + * @param string $order + * @param string|null $notNullFields + * @param bool $asObject + * @param string $idKey * * @return array */ - public function getAllExpired($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $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); } /** @@ -453,24 +449,25 @@ public function getNextPublished($obj) /** * @param int $limit * @param int $start - * @param int $categoryid + * @param int $categoryId * @param string $sort * @param string $order - * @param string $notNullFields + * @param string|null $notNullFields * @param bool $asObject * @param string $idKey * * @return array */ - public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') + public function getAllSubmitted($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') { - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_SUBMITTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey); + $notNullFields = (null !== $notNullFields) ?: ''; + 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 @@ -479,15 +476,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 @@ -496,27 +493,28 @@ 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 $notNullFields + * @param string|null $notNullFields * @param bool $asObject * @param null|\CriteriaCompo $otherCriteria * @param bool|string $idKey * @return array * @internal param bool $asObject */ - public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $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; if (!$this->publisherIsAdmin) { $criteriaPermissions = new \CriteriaCompo(); @@ -530,10 +528,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)) { @@ -563,7 +561,7 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $criteria->setStart($start); $criteria->setSort($sort); $criteria->order = $order; // patch for XOOPS <= 2.5.10 does not set order correctly using setOrder() method - $ret = &$this->getObjects($criteria, $idKey, $notNullFields); + $ret = &$this->getObjects($criteria, $idKey, true); return $ret; } @@ -575,7 +573,6 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, * * @return bool * @throws \Exception - * @throws \Exception */ public function getRandomItem($field = '', $status = '', $categoryId = -1) { @@ -585,10 +582,10 @@ public function getRandomItem($field = '', $status = '', $categoryId = -1) $totalItems = $this->getItemsCount($categoryId, $status, $notNullFields); if ($totalItems > 0) { --$totalItems; - $entryNumber = \random_int(0, $totalItems); //TODO switch in PHP 7 to random_int() -// $entryNumber2 = random_int(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]; } @@ -600,10 +597,10 @@ public function getRandomItem($field = '', $status = '', $categoryId = -1) /** * delete Items matching a set of conditions * - * @param \CriteriaElement $criteria {@link CriteriaElement} + * @param \CriteriaElement|null $criteria {@link CriteriaElement} * - * @param bool $force - * @param bool $asObject + * @param bool $force + * @param bool $asObject * @return bool FALSE if deletion failed */ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null) @@ -618,13 +615,13 @@ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asO } /** - * @param $itemid + * @param $itemId * * @return bool */ - public function updateCounter($itemid) + public function updateCounter($itemId) { - $sql = 'UPDATE ' . $this->db->prefix($this->helper->getDirname() . '_items') . ' SET counter=counter+1 WHERE itemid = ' . $itemid; + $sql = 'UPDATE ' . $this->db->prefix($this->helper->getDirname() . '_items') . ' SET counter=counter+1 WHERE itemid = ' . $itemId; if ($this->db->queryF($sql)) { return true; } @@ -673,11 +670,11 @@ public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $count = 0; $ret = []; $criteriaKeywords = $criteriaPermissions = $criteriaUser = null; - /* @var \XoopsGroupPermHandler $grouppermHandler */ + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); $groups = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; $searchin = empty($searchin) ? ['title', 'body', 'summary'] : (\is_array($searchin) ? $searchin : [$searchin]); - if (\in_array('all', $searchin) || 0 === \count($searchin)) { + if (\in_array('all', $searchin, true) || 0 === \count($searchin)) { $searchin = ['title', 'subtitle', 'body', 'summary', 'meta_keywords']; //add support for searching in tags if Tag module exists and is active if (false !== $this->helper::getHelper('tag')) { diff --git a/class/Metagen.php b/class/Metagen.php index 5416ef59..05a962e1 100644 --- a/class/Metagen.php +++ b/class/Metagen.php @@ -17,7 +17,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -25,8 +24,6 @@ use XoopsModules\Publisher; - - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -38,37 +35,30 @@ class Metagen * @var Publisher\Helper */ public $helper; - /** * @var \MyTextSanitizer */ public $myts; - /** * @var string */ public $title; - /** * @var string */ public $originalTitle; - /** * @var string */ public $keywords; - /** * @var string */ public $categoryPath; - /** * @var string */ public $description; - /** * @var int */ @@ -82,7 +72,7 @@ class Metagen */ public function __construct($title, $keywords = '', $description = '', $categoryPath = '') { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ + /** @var \XoopsModules\Publisher\Helper $this->helper */ $this->helper = \XoopsModules\Publisher\Helper::getInstance(); $this->myts = \MyTextSanitizer::getInstance(); $this->setCategoryPath($categoryPath); @@ -199,7 +189,7 @@ public function findMetaKeywords($text, $minChar) $secondRoundKeywords = \explode("'", $originalKeyword); foreach ($secondRoundKeywords as $secondRoundKeyword) { if (mb_strlen($secondRoundKeyword) >= $minChar) { - if (!\in_array($secondRoundKeyword, $keywords)) { + if (!\in_array($secondRoundKeyword, $keywords, true)) { $keywords[] = \trim($secondRoundKeyword); } } @@ -342,14 +332,16 @@ public static function generateSeoTitle($title = '', $withExt = true) $repPat = ['-', 'e', 'e', 'e', 'e', 'c', 'a', 'a', 'a', 'i', 'i', 'u', 'u', 'u', 'o', 'o']; $title = \preg_replace($pattern, $repPat, $title); $tableau = \explode('-', $title); // Transforms the string in table //Transforme la chaine de caractères en tableau - $tableau = \array_filter($tableau, ['XoopsModules\Publisher\Metagen', 'emptyString']); // Remove empty strings of the table //Supprime les chaines vides du tableau + $tableau = \array_filter($tableau, [__CLASS__, 'emptyString']); // Remove empty strings of the table //Supprime les chaines vides du tableau $title = \implode('-', $tableau); // Transforms a character string in table separated by a hyphen //Transforme un tableau en chaine de caractères séparé par un tiret if ($title && !(\is_array($title))) { if ($withExt) { $title .= '.html'; } + return $title; } + return ''; } diff --git a/class/Mimetype.php b/class/Mimetype.php index 78117b28..9dc06f37 100644 --- a/class/Mimetype.php +++ b/class/Mimetype.php @@ -19,7 +19,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -27,15 +26,12 @@ use XoopsModules\Publisher; - - require_once \dirname(__DIR__) . '/include/common.php'; /** * Mimetype class * * @author Eric Juden - * @package publisher */ class Mimetype extends \XoopsObject { diff --git a/class/MimetypeHandler.php b/class/MimetypeHandler.php index 0ca82d1a..4b915151 100644 --- a/class/MimetypeHandler.php +++ b/class/MimetypeHandler.php @@ -19,7 +19,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -27,8 +26,6 @@ use XoopsModules\Publisher; - - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -38,13 +35,12 @@ class MimetypeHandler extends BaseObjectHandler { /** * Constructor - * - * @param \XoopsDatabase $db + * @param \XoopsDatabase|null $db * @param \XoopsModules\Publisher\Helper|null $helper */ public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null) { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ + /** @var \XoopsModules\Publisher\Helper $this->helper */ if (null === $helper) { $this->helper = \XoopsModules\Publisher\Helper::getInstance(); } else { @@ -59,9 +55,9 @@ public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\H /** * retrieve a mimetype object from the database * - * @param int $id ID of mimetype + * @param int|null $id ID of mimetype * - * @param null $fields + * @param array|null $fields * @return bool|Mimetype */ public function get($id = null, $fields = null) @@ -86,13 +82,13 @@ public function get($id = null, $fields = null) /** * retrieve objects from the database * - * @param \CriteriaElement $criteria {@link CriteriaElement} - * conditions to be met + * @param \CriteriaElement|null $criteria {@link CriteriaElement} + * conditions to be met * - * @param bool $idAsKey - * @param bool $asObject + * @param bool $idAsKey + * @param bool $asObject * @return array array of Mimetype objects - * objects + * objects */ public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, $asObject = true) //&getObjects($criteria = null) { @@ -167,11 +163,11 @@ public function getArray($mimeExt = null) public function checkMimeTypes($postField) { $ret = false; - $allowed_mimetypes = $this->getArrayByType(); - if (empty($allowed_mimetypes)) { + $allowedMimetypes = $this->getArrayByType(); + if (empty($allowedMimetypes)) { return $ret; } - foreach ($allowed_mimetypes as $mime) { + foreach ($allowedMimetypes as $mime) { if ($mime == $_FILES[$postField]['type']) { $ret = $mime; break; @@ -200,9 +196,9 @@ public function getArrayByType() /** * Create a "select" SQL query * - * @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement} + * @param \CriteriaElement|null $criteria {@link CriteriaElement} * to match - * @param bool $join + * @param bool $join * * @return string string SQL query */ @@ -219,8 +215,7 @@ private function selectQuery(\CriteriaElement $criteria = null, $join = false) if ($join) { throw new \RuntimeException('no need for join...'); } - } catch (\Exception $e) { - /** @var Publisher\Helper $helper */ + } catch (\Throwable $e) { $helper = Publisher\Helper::getInstance(); $helper->addLog($e); echo 'no need for join...'; diff --git a/class/MimetypesUtility.php b/class/MimetypesUtility.php index 20fc9bab..cb932f0e 100644 --- a/class/MimetypesUtility.php +++ b/class/MimetypesUtility.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace XoopsModules\Publisher; +use XoopsModules\Publisher\Utility; /* You may not change or alter any portion of this comment or credits @@ -19,7 +20,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -37,17 +37,16 @@ class MimetypesUtility { public static function add() { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimetypeHandler = $helper->getHandler('Mimetype'); global $limit, $start; $error = []; if (!Request::getString('add_mime', '', 'POST')) { - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); - Publisher\Utility::openCollapsableBar('mimemaddtable', 'mimeaddicon', \_AM_PUBLISHER_MIME_ADD_TITLE); + Utility::openCollapsableBar('mimemaddtable', 'mimeaddicon', \_AM_PUBLISHER_MIME_ADD_TITLE); $session = Publisher\Session::getInstance(); $mimeType = $session->get('publisher_addMime'); @@ -55,7 +54,7 @@ public static function add() //Display any form errors if (false === !$mimeErrors) { - Publisher\Utility::renderErrors($mimeErrors, Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearAddSession'])); + Utility::renderErrors($mimeErrors, Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearAddSession'])); } if (false === $mimeType) { @@ -125,7 +124,7 @@ public static function add() echo ''; - Publisher\Utility::closeCollapsableBar('mimeaddtable', 'mimeaddicon'); + Utility::closeCollapsableBar('mimeaddtable', 'mimeaddicon'); \xoops_cp_footer(); } else { @@ -162,7 +161,7 @@ public static function add() $mime['mime_user'] = $mimeUser; $session->set('publisher_addMime', $mime); $session->set('publisher_addMimeErr', $error); - \header('Location: ' . Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); + \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); } $mimeType = $mimetypeHandler->create(); @@ -183,7 +182,6 @@ public static function add() public static function delete() { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimetypeHandler = $helper->getHandler('Mimetype'); @@ -204,7 +202,6 @@ public static function delete() public static function edit() { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimetypeHandler = $helper->getHandler('Mimetype'); @@ -225,14 +222,14 @@ public static function edit() $mimeErrors = $session->get('publisher_editMimeErr_' . $mimeId); // Display header - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_EDIT); - Publisher\Utility::openCollapsableBar('mimemedittable', 'mimeediticon', \_AM_PUBLISHER_MIME_EDIT_TITLE); + Utility::openCollapsableBar('mimemedittable', 'mimeediticon', \_AM_PUBLISHER_MIME_EDIT_TITLE); //Display any form errors if (false === !$mimeErrors) { - Publisher\Utility::renderErrors($mimeErrors, Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearEditSession', 'id' => $mimeId])); + Utility::renderErrors($mimeErrors, Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearEditSession', 'id' => $mimeId])); } if (false === $mimeType) { @@ -291,7 +288,7 @@ public static function edit() "; echo ''; // end of edit form - Publisher\Utility::closeCollapsableBar('mimeedittable', 'mimeediticon'); + Utility::closeCollapsableBar('mimeedittable', 'mimeediticon'); // xoops_cp_footer(); require_once \dirname(__DIR__) . '/admin/admin_footer.php'; } else { @@ -330,7 +327,7 @@ public static function edit() $mime['mime_user'] = $mimeUser; $session->set('publisher_editMime_' . $mimeId, $mime); $session->set('publisher_editMimeErr_' . $mimeId, $error); - \header('Location: ' . Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeId], false)); + \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeId], false)); } $mimeTypeObj->setVar('mime_ext', Request::getString('mime_ext', '', 'POST')); @@ -350,10 +347,8 @@ public static function edit() public static function manage() { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); - /** @var Publisher\Utility $utility */ - $utility = new Publisher\Utility(); + $utility = new Utility(); /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimetypeHandler = $helper->getHandler('Mimetype'); global $imagearray, $start, $limit, $aSortBy, $aOrderBy, $aLimitBy, $aSearchBy; @@ -378,9 +373,9 @@ public static function manage() \redirect_header(PUBLISHER_ADMIN_URL . '/mimetypes.php?op=search', 3, \_AM_PUBLISHER_MIME_SEARCH); } - Publisher\Utility::cpHeader(); + Utility::cpHeader(); ////publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); - Publisher\Utility::openCollapsableBar('mimemanagetable', 'mimemanageicon', \_AM_PUBLISHER_MIME_MANAGE_TITLE, \_AM_PUBLISHER_MIME_INFOTEXT); + Utility::openCollapsableBar('mimemanagetable', 'mimemanageicon', \_AM_PUBLISHER_MIME_MANAGE_TITLE, \_AM_PUBLISHER_MIME_INFOTEXT); $crit = new \CriteriaCompo(); $order = Request::getString('order', 'ASC', 'POST'); $sort = Request::getString('sort', 'mime_ext', 'POST'); @@ -487,7 +482,7 @@ public static function manage() echo ''; echo "
    " . $nav->renderNav() . '

    '; - Publisher\Utility::closeCollapsableBar('mimemanagetable', 'mimemanageicon'); + Utility::closeCollapsableBar('mimemanagetable', 'mimemanageicon'); // xoops_cp_footer(); require_once \dirname(__DIR__) . '/admin/admin_footer.php'; @@ -495,7 +490,6 @@ public static function manage() public static function search() { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimetypeHandler = $helper->getHandler('Mimetype'); @@ -520,10 +514,10 @@ public static function search() $order = Request::getString('order', 'ASC'); $sort = Request::getString('sort', 'mime_name'); - Publisher\Utility::cpHeader(); + Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH); - Publisher\Utility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', \_AM_PUBLISHER_MIME_SEARCH); + Utility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', \_AM_PUBLISHER_MIME_SEARCH); if (!Request::hasVar('mime_search')) { echo "
    "; @@ -671,7 +665,7 @@ public static function search() echo ''; echo "'; } - Publisher\Utility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); + Utility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); // require_once dirname(__DIR__) . '/admin/admin_footer.php'; \xoops_cp_footer(); } @@ -682,14 +676,13 @@ public static function search() public static function updateMimeValue() { // op=updateMimeValue&id=65&mime_admin=0&limit=15&start=0 - Publisher\Utility::cpHeader(); + Utility::cpHeader(); $hiddens = [ 'id' => Request::getInt('id', 0, 'GET'), 'start' => Request::getInt('start', 0, 'GET'), 'limit' => Request::getInt('limit', 15, 'GET'), ]; - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimeTypeObj = $helper->getHandler('Mimetype')->get($hiddens['id']); @@ -710,7 +703,6 @@ public static function updateMimeValue() public static function confirmUpdateMimeValue() { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); /** @var Publisher\MimetypeHandler $mimetypeHandler */ $mimetypeHandler = $helper->getHandler('Mimetype'); @@ -763,11 +755,11 @@ protected static function clearAddSessionVars() public static function clearAddSession() { self::clearAddSessionVars(); - \header('Location: ' . Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); + \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); } /** - * @param $id + * @param int $id */ public static function clearEditSessionVars($id) { @@ -781,6 +773,6 @@ public static function clearEditSession() { $mimeid = Request::getInt('id', '', 'GET'); self::clearEditSessionVars($mimeid); - \header('Location: ' . Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeid], false)); + \header('Location: ' . Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeid], false)); } } diff --git a/class/MyTextSanitizerExtension.php b/class/MyTextSanitizerExtension.php index 082e95ea..a83765d9 100644 --- a/class/MyTextSanitizerExtension.php +++ b/class/MyTextSanitizerExtension.php @@ -17,15 +17,10 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Include * @since 1.0 * @author trabis * @author Taiwen Jiang (phppp or D.J.) */ - -use XoopsModules\Publisher; - \define('MYTEXTSANITIZER_EXTENDED_MEDIA', 1); /** diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index bec51347..150ff371 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -19,8 +19,6 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Class - * @subpackage Handlers * @since 1.0 * @author trabis * @author The SmartFactory @@ -28,7 +26,6 @@ use XoopsModules\Publisher; - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -41,13 +38,9 @@ class PermissionHandler extends \XoopsObjectHandler */ public $helper; - /** - * @param \XoopsDatabase $db - * @param \XoopsModules\Publisher\Helper|null $helper - */ public function __construct(\XoopsDatabase $db = null, \XoopsModules\Publisher\Helper $helper = null) { - /** @var \XoopsModules\Publisher\Helper $this ->helper */ + /** @var \XoopsModules\Publisher\Helper $this->helper */ if (null === $helper) { $this->helper = \XoopsModules\Publisher\Helper::getInstance(); } else { @@ -164,7 +157,7 @@ public function saveItemPermissions($groups, $itemId, $permName) { $result = true; $moduleId = $this->helper->getModule()->getVar('mid'); - /* @var \XoopsGroupPermHandler $grouppermHandler */ + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); // First, if the permissions are already there, delete them $grouppermHandler->deleteByModule($moduleId, $permName, $itemId); diff --git a/class/Rating.php b/class/Rating.php index ab914428..fe848661 100644 --- a/class/Rating.php +++ b/class/Rating.php @@ -18,12 +18,9 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ - - require_once \dirname(__DIR__) . '/include/common.php'; /** diff --git a/class/RatingHandler.php b/class/RatingHandler.php index 79007bdc..060470f4 100644 --- a/class/RatingHandler.php +++ b/class/RatingHandler.php @@ -18,12 +18,9 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis */ - - require_once \dirname(__DIR__) . '/include/common.php'; /** diff --git a/class/Resizer.php b/class/Resizer.php index 503cf9e0..7e525726 100644 --- a/class/Resizer.php +++ b/class/Resizer.php @@ -19,7 +19,6 @@ * * @copyright module for xoops * @license GPL 2.0 or later - * @package XOOPS common * @since 1.0 * @min_xoops 2.5.9 * @author Goffy - Wedega - Email: - Website: @@ -64,27 +63,27 @@ public function resizeImage() // recalc image size based on this->maxWidth/this->maxHeight if ($width > $height) { if ($width < $this->maxWidth) { - $new_width = $width; + $newWidth = $width; } else { - $new_width = $this->maxWidth; - $divisor = $width / $new_width; - $new_height = \floor($height / $divisor); + $newWidth = $this->maxWidth; + $divisor = $width / $newWidth; + $newHeight = \floor($height / $divisor); } } elseif ($height < $this->maxHeight) { - $new_height = $height; + $newHeight = $height; } else { - $new_height = $this->maxHeight; - $divisor = $height / $new_height; - $new_width = \floor($width / $divisor); + $newHeight = $this->maxHeight; + $divisor = $height / $newHeight; + $newWidth = \floor($width / $divisor); } // Create a new temporary image. - $tmpimg = \imagecreatetruecolor($new_width, $new_height); + $tmpimg = \imagecreatetruecolor($newWidth, $newHeight); imagealphablending($tmpimg, false); imagesavealpha($tmpimg, true); // Copy and resize old image into new image. - \imagecopyresampled($tmpimg, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + \imagecopyresampled($tmpimg, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); \unlink($this->endFile); //compressing the file @@ -140,23 +139,23 @@ public function resizeAndCrop() // RESIZE IMAGE AND PRESERVE PROPORTIONS $max_width_resize = $this->maxWidth; - $max_height_resize = $this->maxHeight; + $maxHeightResize = $this->maxHeight; if ($original_w > $original_h) { $max_height_ratio = $this->maxHeight / $original_h; $max_width_resize = (int)\round($original_w * $max_height_ratio); } else { $max_width_ratio = $this->maxWidth / $original_w; - $max_height_resize = (int)\round($original_h * $max_width_ratio); + $maxHeightResize = (int)\round($original_h * $max_width_ratio); } if ($max_width_resize < $this->maxWidth) { $max_height_ratio = $this->maxWidth / $max_width_resize; - $max_height_resize = (int)\round($this->maxHeight * $max_height_ratio); + $maxHeightResize = (int)\round($this->maxHeight * $max_height_ratio); $max_width_resize = $this->maxWidth; } // CREATE THE PROPORTIONAL IMAGE RESOURCE - $thumb = \imagecreatetruecolor($max_width_resize, $max_height_resize); - if (!\imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $max_height_resize, $original_w, $original_h)) { + $thumb = \imagecreatetruecolor($max_width_resize, $maxHeightResize); + if (!\imagecopyresampled($thumb, $original, 0, 0, 0, 0, $max_width_resize, $maxHeightResize, $original_w, $original_h)) { return false; } // CREATE THE CENTERED CROPPED IMAGE TO THE SPECIFIED DIMENSIONS @@ -167,10 +166,10 @@ public function resizeAndCrop() if ($this->maxWidth < $max_width_resize) { $max_width_offset = (int)\round(($max_width_resize - $this->maxWidth) / 2); } else { - $max_height_offset = (int)\round(($max_height_resize - $this->maxHeight) / 2); + $max_height_offset = (int)\round(($maxHeightResize - $this->maxHeight) / 2); } - if (!\imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $max_height_resize)) { + if (!\imagecopy($final, $thumb, 0, 0, $max_width_offset, $max_height_offset, $max_width_resize, $maxHeightResize)) { return false; } // STORE THE FINAL IMAGE - WILL OVERWRITE $this->endFile diff --git a/class/Seo.php b/class/Seo.php index 8f625547..e1291b51 100644 --- a/class/Seo.php +++ b/class/Seo.php @@ -26,8 +26,6 @@ use XoopsModules\Publisher; - - require_once \dirname(__DIR__) . '/include/common.php'; /** @@ -115,7 +113,6 @@ public static function getTitle($title = '', $withExt = true) */ public static function generateUrl($op, $id, $shortUrl = '') { - /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); if ('none' !== $helper->getConfig('seo_url_rewrite')) { if (!empty($shortUrl)) { diff --git a/class/Session.php b/class/Session.php index 690ff3b4..1dd6148d 100644 --- a/class/Session.php +++ b/class/Session.php @@ -18,15 +18,12 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author Harry Fuecks (PHP Anthology Volume II) */ //namespace Publisher; - - require_once \dirname(__DIR__) . '/include/common.php'; /** diff --git a/class/ThemeTabForm.php b/class/ThemeTabForm.php index 8aa2d95a..ad9a2e2c 100644 --- a/class/ThemeTabForm.php +++ b/class/ThemeTabForm.php @@ -18,75 +18,63 @@ * * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author John Neill */ - - require_once \dirname(__DIR__) . '/include/common.php'; /** * XoopsThemeTabForm * - * @package * @author John * @copyright Copyright (c) 2009 */ class ThemeTabForm extends \XoopsForm { public $formTabs = []; - /** * "action" attribute for the html form * * @var string */ public $action; - /** * "method" attribute for the form. * * @var string */ public $method; - /** * "name" attribute of the form * * @var string */ public $name; - /** * title for the form * * @var string */ public $title; - /** * summary for the form (WGAC2 Requirement) * * @var string */ public $summary = ''; - /** * array of {@link XoopsFormElement} objects * * @var array */ public $elements = []; - /** * extra information for the tag * * @var array */ public $extra = []; - /** * required elements * @@ -500,7 +488,7 @@ public function &getRequired() * insert a break in the form * This method is abstract. It must be overwritten in the child classes. * - * @param string $extra extra information for the break + * @param string|null $extra extra information for the break * * @abstract */ diff --git a/class/TrelloDBController.php b/class/TrelloDBController.php new file mode 100644 index 00000000..d89718bb --- /dev/null +++ b/class/TrelloDBController.php @@ -0,0 +1,99 @@ +db = \XoopsDatabaseFactory::getDatabaseConnection(); + } + + /** + * @param $query + * @return mixed + */ + public function runBaseQuery($query) + { + $result = $this->db->conn->query($query); + if ($result->num_rows > 0) { + while (null !== ($row = $result->fetch_assoc())) { + $resultset[] = $row; + } + } + + return $resultset; + } + + /** + * @param $query + * @param $paramType + * @param $paramValueArray + * @return mixed + */ + public function runQuery($query, $paramType, $paramValueArray) + { + $sql = $this->db->conn->prepare($query); + $this->bindQueryParams($sql, $paramType, $paramValueArray); + $sql->execute(); + $result = $sql->get_result(); + + if ($result->num_rows > 0) { + while (null !== ($row = $result->fetch_assoc())) { + $resultset[] = $row; + } + } + + if (!empty($resultset)) { + return $resultset; + } + } + + /** + * @param $sql + * @param $paramType + * @param $paramValueArray + */ + public function bindQueryParams($sql, $paramType, $paramValueArray) + { + $paramValueReference[] = &$paramType; + for ($i = 0, $iMax = count($paramValueArray); $i < $iMax; ++$i) { + $paramValueReference[] = &$paramValueArray[$i]; + } + call_user_func_array([ + $sql, + 'bind_param', + ], $paramValueReference); + } + + /** + * @param $query + * @param $paramType + * @param $paramValueArray + */ + public function insert($query, $paramType, $paramValueArray) + { + $sql = $this->db->conn->prepare($query); + $this->bindQueryParams($sql, $paramType, $paramValueArray); + $sql->execute(); + } + + /** + * @param $query + * @param $paramType + * @param $paramValueArray + */ + public function update($query, $paramType, $paramValueArray) + { + $sql = $this->db->conn->prepare($query); + $this->bindQueryParams($sql, $paramType, $paramValueArray); + $sql->execute(); + } +} diff --git a/class/TrelloManagement.php b/class/TrelloManagement.php new file mode 100644 index 00000000..b9fccb4d --- /dev/null +++ b/class/TrelloManagement.php @@ -0,0 +1,55 @@ +prefix($helper->getDirname() . '_items') . 'WHERE status= ? AND itemid = ?'; + $result = $dbHandle->runQuery($query, 'ii', [$statusId, $itemId]); + + return $result; + } + + /** + * @return mixed + */ + public function getAllStatus() + { + $helper = Helper::getInstance(); + $dbHandle = new TrelloDBController(); + $query = 'SELECT itemid, title, status FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items'); + $result = $dbHandle->runBaseQuery($query); + + return $result; + } + + /** + * @param $statusId + * @param $itemId + */ + public function editTaskStatus($statusId, $itemId) + { + $helper = Helper::getInstance(); + $dbHandle = new TrelloDBController(); + $query = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . 'SET status = ? WHERE itemid = ?'; + $result = $dbHandle->update($query, 'ii', [$statusId, $itemId]); + + return $result; + } +} diff --git a/class/Utility.php b/class/Utility.php index 516e55bb..3424004e 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -20,14 +20,14 @@ * @copyright XOOPS Project (https://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author XOOPS Development Team - * @package Publisher * @since 1.03 */ use Xmf\Request; use XoopsModules\Publisher; -use XoopsModules\Publisher\Common; -use XoopsModules\Publisher\Constants; +use XoopsModules\Publisher\Category; +use XoopsModules\Publisher\Helper; +use XoopsModules\Publisher\Item; /** * Class Utility @@ -35,7 +35,6 @@ class Utility extends Common\SysUtility { //--------------- Custom module methods ----------------------------- - /** * Function responsible for checking if a directory exists, we can also write in and create an index.html file * @@ -50,7 +49,7 @@ public static function createFolder($folder) } file_put_contents($folder . '/index.html', ''); } - } catch (\Exception $e) { + } catch (\Throwable $e) { echo 'Caught exception: ', $e->getMessage(), "\n", '
    '; } } @@ -172,13 +171,12 @@ public static function buildTableItemTitleRow() } /** - * @param \XoopsModules\Publisher\Category $categoryObj - * @param int $level + * @param Category $categoryObj + * @param int $level */ - public static function displayCategory(Publisher\Category $categoryObj, $level = 0) + public static function displayCategory(Category $categoryObj, $level = 0) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); $description = $categoryObj->description(); if (!XOOPS_USE_MULTIBYTES) { @@ -227,28 +225,25 @@ public static function displayCategory(Publisher\Category $categoryObj, $level = } /** - * @param bool $showmenu - * @param int $categoryId - * @param int $nbSubCats - * @param null $categoryObj + * @param bool $showmenu + * @param int $categoryId + * @param int $nbSubCats + * @param Category|null $categoryObj */ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCats = 4, $categoryObj = null) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); // if there is a parameter, and the id exists, retrieve data: we're editing a category - /* @var Publisher\Category $categoryObj */ + /** @var Category $categoryObj */ if (0 != $categoryId) { // Creating the category object for the selected category $categoryObj = $helper->getHandler('Category')->get($categoryId); if ($categoryObj->notLoaded()) { \redirect_header('category.php', 1, \_AM_PUBLISHER_NOCOLTOEDIT); } - } else { - if (!$categoryObj) { - $categoryObj = $helper->getHandler('Category')->create(); - } + } elseif (null === $categoryObj) { + $categoryObj = $helper->getHandler('Category')->create(); } if (0 != $categoryId) { @@ -326,7 +321,17 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa for ($i = 0; $i < $totalitemsOnPage; ++$i) { $categoryObj = $allcats[$itemsObj[$i]->categoryid()]; $modify = "getModule()->dirname() . "/assets/images/links/edit.gif' title='" . \_AM_PUBLISHER_EDITITEM . "' alt='" . \_AM_PUBLISHER_EDITITEM . "'>"; - $delete = "getModule()->dirname() . "/assets/images/links/delete.png' title='" . \_AM_PUBLISHER_DELETEITEM . "' alt='" . \_AM_PUBLISHER_DELETEITEM . "'>"; + $delete = "getModule()->dirname() + . "/assets/images/links/delete.png' title='" + . \_AM_PUBLISHER_DELETEITEM + . "' alt='" + . \_AM_PUBLISHER_DELETEITEM + . "'>"; echo ''; echo "" . $itemsObj[$i]->itemid() . ''; echo "" . $categoryObj->name() . ''; @@ -336,7 +341,7 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa echo ''; } } else { - $itemid = -1; + $itemId = -1; echo ''; echo "" . \_AM_PUBLISHER_NOITEMS . ''; echo ''; @@ -504,8 +509,7 @@ public static function getAllowedImagesTypes() */ public static function moduleHome($withLink = true) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); if (!$helper->getConfig('format_breadcrumb_modname')) { return ''; @@ -697,8 +701,7 @@ public static function formatErrors($errors = []) */ public static function userIsAdmin() { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); static $publisherIsAdmin; @@ -735,11 +738,10 @@ public static function userIsAuthor($itemObj) */ public static function userIsModerator($itemObj) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); $categoriesGranted = $helper->getHandler('Permission')->getGrantedItems('category_moderation'); - return (\is_object($itemObj) && \in_array($itemObj->categoryid(), $categoriesGranted)); + return (\is_object($itemObj) && \in_array($itemObj->categoryid(), $categoriesGranted, true)); } /** @@ -752,13 +754,12 @@ public static function userIsModerator($itemObj) */ public static function saveCategoryPermissions($groups, $categoryId, $permName) { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); $result = true; $moduleId = $helper->getModule()->getVar('mid'); - /* @var \XoopsGroupPermHandler $grouppermHandler */ + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); // First, if the permissions are already there, delete them $grouppermHandler->deleteByModule($moduleId, $permName, $categoryId); @@ -890,16 +891,15 @@ public static function getCurrentPage() } /** - * @param null|Publisher\Category $categoryObj - * @param int|array $selectedId - * @param int $level - * @param string $ret + * @param null|Category $categoryObj + * @param int|array $selectedId + * @param int $level + * @param string $ret * @return string */ - public static function addCategoryOption(Publisher\Category $categoryObj, $selectedId = 0, $level = 0, $ret = '') + public static function addCategoryOption(Category $categoryObj, $selectedId = 0, $level = 0, $ret = '') { - /** @var Publisher\Helper $helper */ - $helper = Publisher\Helper::getInstance(); + $helper = Helper::getInstance(); $spaces = ''; for ($j = 0; $j < $level; ++$j) { @@ -907,7 +907,7 @@ public static function addCategoryOption(Publisher\Category $categoryObj, $selec } $ret .= "
    @@ -50,11 +50,11 @@
    <{/if}> <{if $block.truncate}> - <{if $block.display_readmore}> + <{if $block.display_readmore}> <{/if}> - <{/if}> + <{/if}> <{/if}> <{/foreach}> <{/if}> @@ -62,4 +62,4 @@ <{if $block.lang_displaymore}>

    -<{/if}> \ No newline at end of file +<{/if}> diff --git a/templates/blocks/publisher_latest_news.tpl b/templates/blocks/publisher_latest_news.tpl index 80d019da..6fe48e1b 100644 --- a/templates/blocks/publisher_latest_news.tpl +++ b/templates/blocks/publisher_latest_news.tpl @@ -7,45 +7,45 @@ <{foreach item=item from=$block.columns[i]}>
  • <{$item.title}>
    <{if $item.display_item_image}> - <{if $item.item_image != ''}> - <{$item.alt}>
    - <{else}> - <{$item.alt}> - <{/if}> + <{if $item.item_image != ''}> + <{$item.alt}>
    + <{else}> + <{$item.alt}> + <{/if}> <{/if}> - - <{if $item.display_summary}> - <{$item.text}>
    - <{/if}> - <{$item.more}>

    + + <{if $item.display_summary}> + <{$item.text}>
    + <{/if}> + <{$item.more}>

    <{if $item.topic_title}> <{$block.lang_category}> : <{$item.topic_title}> | <{/if}> - <{if $item.poster}> - <{$block.lang_poster}> <{$item.poster}> | - <{/if}> - <{if $item.posttime}> - <{$item.posttime}> | - <{/if}> - <{if $item.read }> - <{$item.read}> <{$block.lang_reads}> | - <{/if}> + <{if $item.poster}> + <{$block.lang_poster}> <{$item.poster}> | + <{/if}> + <{if $item.posttime}> + <{$item.posttime}> | + <{/if}> + <{if $item.read }> + <{$item.read}> <{$block.lang_reads}> | + <{/if}> <{if $item.comment && $item.cancomment && $item.comment != -1}> - <{$item.comment}> + <{$item.comment}> <{/if}> - - -
  • + + <{/foreach}> <{/section}> -
    <{$block.topiclink}><{$block.morelink}><{$block.archivelink}><{$block.submitlink}> - +
    <{$block.topiclink}><{$block.morelink}><{$block.archivelink}><{$block.submitlink}> + <{if $block.latestnews_scroll }> <{/if}> @@ -70,30 +70,30 @@
    - + <{if $item.topic_title}> <{$block.lang_category}> : <{$item.topic_title}> | <{/if}> - <{if $item.poster}> - <{$block.lang_poster}> <{$item.poster}> | - <{/if}> + <{if $item.poster}> + <{$block.lang_poster}> <{$item.poster}> | + <{/if}> <{if $item.posttime}> - <{$item.posttime}> | - <{/if}> + <{$item.posttime}> | + <{/if}> <{if $item.read }> - <{$item.read}> <{$block.lang_reads}> | - <{/if}> + <{$item.read}> <{$block.lang_reads}> | + <{/if}> <{if $item.comment && $item.cancomment && $item.comment != -1}> - <{$item.comment}> - <{/if}> + <{$item.comment}> + <{/if}>
    <{if $item.display_item_image}> - <{if $item.item_image != ''}> - <{$item.alt}> - <{else}> - <{$item.alt}> - <{/if}> + <{if $item.item_image != ''}> + <{$item.alt}> + <{else}> + <{$item.alt}> + <{/if}> <{/if}> @@ -102,17 +102,17 @@ <{if $block.letters != 0}>
    - <{if $item.display_summary}> - <{$item.text}>
    - <{/if}> - <{$item.more}> + <{if $item.display_summary}> + <{$item.text}>
    + <{/if}> + <{$item.more}>
    <{/if}>
    <{$item.print}><{$item.pdf}><{$item.email}> - <{if $item.display_adminlink}> <{$item.admin}> + <{if $item.display_adminlink}> <{$item.admin}> <{/if}>
    diff --git a/templates/publisher_archive.tpl b/templates/publisher_archive.tpl index c6c9d5c0..c165a869 100644 --- a/templates/publisher_archive.tpl +++ b/templates/publisher_archive.tpl @@ -21,64 +21,64 @@ - <{if $showcategory == 1}> + <{if $showcategory == 1}> - <{/if}> - <{if $showposter == 1}> - - <{/if}> - <{if $showhits == 1}> - - <{/if}> - <{if $showdate == 1}> + <{/if}> + <{if $showposter == 1}> + + <{/if}> + <{if $showhits == 1}> + + <{/if}> + <{if $showdate == 1}> - <{/if}> - <{if $showpdfbutton == 1 OR $showprintlink == 1 OR $showemaillink == 1}> - - <{/if}> + <{/if}> + <{if $showpdfbutton == 1 OR $showprintlink == 1 OR $showemaillink == 1}> + + <{/if}> - - + + <{foreach item=story from=$stories}> "> - - <{if $showcategory == 1}> - - <{/if}> - <{if $showposter == 1}> +
      <{$story.comment}> + <{/if}> + + <{if $showcategory == 1}> + + <{/if}> + <{if $showposter == 1}> - <{/if}> - <{if $showhits == 1}> - - <{/if}> - <{if $showdate == 1}> + <{/if}> + <{if $showhits == 1}> + + <{/if}> + <{if $showdate == 1}> - <{/if}> - <{if $showpdfbutton == 1 OR $showprintlink == 1 OR $showemaillink == 1}> - - <{/if}> - + + <{/if}> + <{/foreach}>
    <{$lang_articles}><{$lang_category}><{$lang_author}><{$lang_views}><{$lang_author}><{$lang_views}><{$lang_date}><{$lang_actions}><{$lang_actions}>
    - <{if $showmainimage == 1}> - <{$story.cleantitle}>
    - <{/if}> -   <{$story.title}> - <{if $showsummary == 1}>
    -   <{$story.summary}> - <{/if}> +
    + <{if $showmainimage == 1}> + <{$story.cleantitle}>
    + <{/if}> +   <{$story.title}> + <{if $showsummary == 1}>
    +   <{$story.summary}> + <{/if}> <{if $showcomment == 1 && $story.cancomment && $story.comment != -1}> -
      <{$story.comment}> - <{/if}> -
    <{$story.category}><{$story.category}><{$story.author}><{$story.counter}><{$story.counter}><{$story.date}> - <{if $showpdfbutton == 1}> - <{$lang_pdf}> + <{/if}> + <{if $showpdfbutton == 1 OR $showprintlink == 1 OR $showemaillink == 1}> + + <{if $showpdfbutton == 1}> + <{$lang_pdf}> <{/if}> - <{if $showprintlink == 1}> - <{$lang_printer}> + <{if $showprintlink == 1}> + <{$lang_printer}> <{/if}> - <{if $showemaillink == 1}> - "> + <{if $showemaillink == 1}> + "> <{/if}> -

    <{$lang_storytotal}>
    diff --git a/templates/publisher_author_items.tpl b/templates/publisher_author_items.tpl index 460220b2..9f69618a 100644 --- a/templates/publisher_author_items.tpl +++ b/templates/publisher_author_items.tpl @@ -11,7 +11,7 @@ <{foreach item=category from=$categories}> <{if $permRating && $displayrating}> - + <{else}> <{/if}> <{$category.link}> @@ -23,9 +23,9 @@ <{$smarty.const._CO_PUBLISHER_DATESUB}>  <{$smarty.const._CO_PUBLISHER_TITLE}> - <{if $displayhits}> + <{if $displayhits}> <{$smarty.const._MD_PUBLISHER_HITS}> - <{/if}> + <{/if}> <{if $permRating && $displayrating}>    <{$smarty.const._MD_PUBLISHER_VOTE_RATING}> <{/if}> @@ -34,20 +34,20 @@ <{$item.published}> - <{if $displaymainimage}> - <{$item.cleantitle}> - <{/if}> -   <{$item.link}> - <{if $displaysummary}> -
      <{$item.summary}> - <{/if}> - <{if $displaycomment && $item.cancomment && $item.comment != -1}> -
      <{$item.comment}> - <{/if}> - + <{if $displaymainimage}> + <{$item.cleantitle}> + <{/if}> +   <{$item.link}> + <{if $displaysummary}> +
      <{$item.summary}> + <{/if}> + <{if $displaycomment && $item.cancomment && $item.comment != -1}> +
      <{$item.comment}> + <{/if}> + <{if $displayhits}> - <{$item.hits}> - <{/if}> + <{$item.hits}> + <{/if}> <{if $permRating && $displayrating}>   <{$item.rating}> <{/if}> @@ -56,9 +56,9 @@
    <{$smarty.const._MD_PUBLISHER_TOTAL_ITEMS}><{$category.count_items}> <{if $displayhits}> -
    <{$smarty.const._MD_PUBLISHER_TOTAL_HITS}><{$category.count_hits}> +
    <{$smarty.const._MD_PUBLISHER_TOTAL_HITS}><{$category.count_hits}> <{/if}> - <{if $permRating && $displayrating}> + <{if $permRating && $displayrating}>   <{/if}> diff --git a/templates/publisher_display_list.tpl b/templates/publisher_display_list.tpl index 1dbb0cb6..1cfcc179 100644 --- a/templates/publisher_display_list.tpl +++ b/templates/publisher_display_list.tpl @@ -32,32 +32,32 @@ <{foreach item=item from=$items}> -
    +
    <{$item.titlelink}>
    - <{if $show_subtitle && $item.subtitle}> + <{if $show_subtitle && $item.subtitle}> <{$item.subtitle}>
    <{/if}> - - <{if $display_category == 1}> <{$smarty.const._MD_PUBLISHER_CATEGORY}> : <{$item.category}> | <{/if}> + + <{if $display_category == 1}> <{$smarty.const._MD_PUBLISHER_CATEGORY}> : <{$item.category}> | <{/if}> <{if $display_poster == 1}> <{$smarty.const._MD_PUBLISHER_POSTER}> <{$item.who}><{/if}> <{if $display_date_col == 1}> | <{$item.datesub}> <{/if}> <{if $display_hits_col == 1}> | <{$item.counter}> <{$smarty.const._MD_PUBLISHER_TOTALHITS}> <{/if}> <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> | <{$item.comments}><{/if}> - -
    + +
    - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path!=''}> - <{$item.title}> - <{else}> - <{$item.title}> - <{/if}> + <{$item.title}> + <{else}> + <{$item.title}> + <{/if}> <{/if}> - <{if $display_summary == 1}><{$item.summary}>
    <{/if}> -
    + <{if $display_summary == 1}><{$item.summary}>
    <{/if}> +
    @@ -65,10 +65,10 @@ <{if $display_readmore == 1}>
    +
    <{/if}> -
    +
    <{/foreach}> diff --git a/templates/publisher_display_summary.tpl b/templates/publisher_display_summary.tpl index a11aaa70..5866557f 100644 --- a/templates/publisher_display_summary.tpl +++ b/templates/publisher_display_summary.tpl @@ -43,7 +43,7 @@ <{/if}> <{if $display_hits_col == 1}> <{$smarty.const._MD_PUBLISHER_HITS}> <{/if}> - <{if $display_poster == 1}> + <{if $display_poster == 1}> <{$smarty.const._MD_PUBLISHER_AUTHOR}> <{/if}> @@ -51,31 +51,31 @@ <{foreach item=item from=$items}> - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path!=''}> - <{$item.title}> - <{else}> - <{$item.title}> - <{/if}> - <{/if}> - <{$item.titlelink}> + <{$item.title}> + <{else}> + <{$item.title}> + <{/if}> + <{/if}> + <{$item.titlelink}> <{if $show_subtitle && $item.subtitle}>
    <{$item.subtitle}> <{/if}> -
    - <{if $display_summary == 1}> +
    + <{if $display_summary == 1}> <{$item.summary}>
    <{/if}> - <{if $display_readmore == 1}> - <{$smarty.const._MD_PUBLISHER_READMORE}>
    + <{if $display_readmore == 1}> + <{$smarty.const._MD_PUBLISHER_READMORE}>
    <{/if}> - + <{if $display_category == 1}> <{$item.category}> | <{/if}> <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}><{$item.comments}><{/if}> - + <{if $display_date_col == 1}> @@ -87,7 +87,7 @@
    <{$item.counter}>
    <{/if}> - <{if $display_poster == 1}> + <{if $display_poster == 1}>
    <{$item.who}>
    diff --git a/templates/publisher_display_wfsection.tpl b/templates/publisher_display_wfsection.tpl index 7bcc6959..d10e182d 100644 --- a/templates/publisher_display_wfsection.tpl +++ b/templates/publisher_display_wfsection.tpl @@ -74,31 +74,31 @@ <{foreach item=item from=$items}>
    - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path!=''}> - <{$item.title}> - <{else}> - <{$item.title}> - <{/if}> + <{$item.title}> + <{else}> + <{$item.title}> + <{/if}> <{/if}>
    <{$item.titlelink}>
    - <{if $show_subtitle && $item.subtitle}> + <{if $show_subtitle && $item.subtitle}> <{$item.subtitle}>
    <{/if}> - - <{if $display_category == 1}> <{$smarty.const._MD_PUBLISHER_CATEGORY}> : <{$item.category}> | <{/if}> + + <{if $display_category == 1}> <{$smarty.const._MD_PUBLISHER_CATEGORY}> : <{$item.category}> | <{/if}> <{if $display_poster == 1}> <{$smarty.const._MD_PUBLISHER_POSTER}> <{$item.who}><{/if}> <{if $display_date_col == 1}> | <{$item.datesub}> <{/if}> <{if $display_hits_col == 1}> | <{$item.counter}> <{$smarty.const._MD_PUBLISHER_TOTALHITS}> <{/if}> <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> | <{$item.comments}><{/if}> - -
    + +
    <{if $display_summary == 1}> <{$item.summary}>
    <{/if}> - - -
    + + +
    @@ -108,7 +108,7 @@ <{$smarty.const._MD_PUBLISHER_READMORE}>
    <{/if}> -
    +
    <{/foreach}> diff --git a/templates/publisher_item.tpl b/templates/publisher_item.tpl index d78f4345..38bef1e0 100644 --- a/templates/publisher_item.tpl +++ b/templates/publisher_item.tpl @@ -13,32 +13,32 @@ <{if $show_subtitle && $item.subtitle}>

    <{$item.subtitle}>

    <{/if}> - <{if $display_itemcategory}> + <{if $display_itemcategory}>  <{$smarty.const._MD_PUBLISHER_CATEGORY}> : <{$item.category}> <{/if}> <{if $display_who_link}> | <{$smarty.const._MD_PUBLISHER_POSTER}> <{$item.who}> <{/if}> - <{if $display_when_link}> + <{if $display_when_link}> <{$item.when}> <{/if}> - <{if $display_hits_link}> - (<{$item.counter}> <{$smarty.const._MD_PUBLISHER_READS}>) + <{if $display_hits_link}> + (<{$item.counter}> <{$smarty.const._MD_PUBLISHER_READS}>) <{/if}> - + -
    +
    <{if $pagenav}>
    <{$smarty.const._MD_PUBLISHER_PAGE}>: <{$pagenav}>
    <{/if}>
    - <{if $item.image_path==''}> - <{if $display_defaultimage}> - <{$item.title}> - <{/if}> - <{/if}> + <{if $item.image_path==''}> + <{if $display_defaultimage}> + <{$item.title}> + <{/if}> + <{/if}> <{if $item.image_path || $item.images}>
      @@ -90,7 +90,7 @@ <{/foreach}>
    <{/if}> - + <{if $pagenav}>
    <{$smarty.const._MD_PUBLISHER_PAGE}>: <{$pagenav}>
    @@ -220,35 +220,35 @@ <{foreach item=item from=$items}> - + - <{if $show_mainimage == 1}> - <{if $item.item_image==''}> - <{$item.title}> - <{else}> - <{$item.title}> + <{if $show_mainimage == 1}> + <{if $item.item_image==''}> + <{$item.title}> + <{else}> + <{$item.title}> <{/if}> - <{/if}> - <{$item.titlelink}> - - <{if $show_summary == 1}>
    <{$item.summary}>
    <{/if}> - <{if $show_readmore == 1}> - <{$item.more}>
    + <{/if}> + <{$item.titlelink}> + + <{if $show_summary == 1}>
    <{$item.summary}>
    <{/if}> + <{if $show_readmore == 1}> + <{$item.more}>
    <{/if}> - - <{if $show_poster == 1}> + + <{if $show_poster == 1}>
    <{$smarty.const._MD_PUBLISHER_POSTER}> <{$item.who}> <{/if}> - <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> + <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> | <{$item.comments}> <{/if}> - + <{if $show_date_col == 1}>
    <{$item.datesub}>
    <{/if}> -
    +
    <{if $show_hits_col == 1}>
    <{$item.counter}>
    @@ -271,4 +271,4 @@ $publisher('#ppy3').popeye(options); }); //]]>--> - \ No newline at end of file + diff --git a/templates/publisher_print.tpl b/templates/publisher_print.tpl index aa5bdafa..787ac923 100644 --- a/templates/publisher_print.tpl +++ b/templates/publisher_print.tpl @@ -24,15 +24,15 @@
    - +
    <{$xoops_sitename}> (<{$xoops_url}>)

    <{$xoops_slogan}>

    -
    +
    <{if $printheader!=''}> -
    <{$printheader}>
    +
    <{$printheader}>
    <{/if}> - - <{$item.image}> + + <{$item.image}> <{if !$noTitle}>

    <{$item.title}>

    diff --git a/templates/publisher_rss.tpl b/templates/publisher_rss.tpl index 1e0ad09d..8a0f4aa0 100644 --- a/templates/publisher_rss.tpl +++ b/templates/publisher_rss.tpl @@ -7,7 +7,7 @@ <{$channel_lastbuild}> http://backend.userland.com/rss/ <{$channel_generator}> - <{$channel_category}> + <{$channelCategory}> <{$channel_editor}> <{$channel_webmaster}> <{$channel_language}> diff --git a/templates/publisher_singleitem.tpl b/templates/publisher_singleitem.tpl index b3b32880..8e1fb87d 100644 --- a/templates/publisher_singleitem.tpl +++ b/templates/publisher_singleitem.tpl @@ -1,7 +1,7 @@
    <{$item.titlelink}> - <{if $show_subtitle && $item.subtitle}> + <{if $show_subtitle && $item.subtitle}>
    <{$item.subtitle}> <{/if}>
    @@ -12,7 +12,7 @@
    - <{if $display_category == 1}> <{$smarty.const._MD_PUBLISHER_CATEGORY}> : <{$item.category}> | <{/if}> + <{if $display_category == 1}> <{$smarty.const._MD_PUBLISHER_CATEGORY}> : <{$item.category}> | <{/if}> <{if $display_poster == 1}> <{$smarty.const._MD_PUBLISHER_POSTER}> <{$item.who}><{/if}> <{if $display_date_col == 1}> | <{$item.datesub}> <{/if}> <{if $display_hits_col == 1}> | <{$item.counter}> <{$smarty.const._MD_PUBLISHER_TOTALHITS}> <{/if}> @@ -24,17 +24,17 @@
    - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path!=''}> - <{$item.title}> - <{else}> - <{$item.title}> - <{/if}> + <{$item.title}> + <{else}> + <{$item.title}> + <{/if}> <{/if}> - <{if $display_summary == 1}> + <{if $display_summary == 1}>
    <{$item.summary}>

    - <{/if}> -

    + <{/if}> +

    <{if $op != 'preview' && $item.summary!=''}> diff --git a/templates/publisher_singleitem_block.tpl b/templates/publisher_singleitem_block.tpl index f664a4a4..d8fd279a 100644 --- a/templates/publisher_singleitem_block.tpl +++ b/templates/publisher_singleitem_block.tpl @@ -6,7 +6,7 @@
    - <{if $block.display_who_link}> <{$block.lang_poster}> <{$item.who}><{/if}> <{if $block.display_when_link}> | <{$item.when}><{/if}> <{if $block.display_reads}> | <{$item.counter}> <{$block.lang_reads}> <{/if}> <{if $block.display_categorylink}> | <{$block.lang_category}> : <{$item.categorylink}><{/if}> + <{if $block.display_who_link}> <{$block.lang_poster}> <{$item.who}><{/if}> <{if $block.display_when_link}> | <{$item.when}><{/if}> <{if $block.display_reads}> | <{$item.counter}> <{$block.lang_reads}> <{/if}> <{if $block.display_categorylink}> | <{$block.lang_category}> : <{$item.categorylink}><{/if}>
    @@ -14,21 +14,21 @@
    - <{if $block.display_item_image}> + <{if $block.display_item_image}> <{if $item.image_path}> <{$item.clean_title}> <{else}> - <{$item.clean_title}> - - <{/if}> - <{/if}> + <{$item.clean_title}> + + <{/if}> + <{/if}> <{$item.summary}> - <{if $block.truncate}> - <{if $block.display_readmore}> -
    + <{if $block.truncate}> + <{if $block.display_readmore}> + <{/if}> - <{/if}> + <{/if}>
    @@ -39,9 +39,9 @@ <{else}>   <{/if}> - <{if $block.display_adminlink}> + <{if $block.display_adminlink}> <{$item.adminlink}> - <{/if}> + <{/if}>
    diff --git a/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_random_item.tpl b/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_random_item.tpl index 81ba173c..28938daf 100644 --- a/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_random_item.tpl +++ b/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_random_item.tpl @@ -1,6 +1,6 @@ <{foreach item=items from=$block.items}> <{if $block.display_item_image == '1'}> - <{$block.alt}> + <{$block.alt}> <{/if}> <{$block.titlelink}>
    diff --git a/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_recent.tpl b/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_recent.tpl index b3564ae9..d4a19e87 100644 --- a/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_recent.tpl +++ b/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_recent.tpl @@ -12,11 +12,11 @@ <{if $block.show_image == '1'}> - <{$item.alt}>
    + <{$item.alt}>
    <{/if}> - <{$item.itemlink}> - <{if $block.show_summary == '1'}>
    <{$item.summary}><{/if}>
    - + <{$item.itemlink}> + <{if $block.show_summary == '1'}>
    <{$item.summary}><{/if}>
    + <{if $block.show_hits == '1'}> <{$item.hits}><{/if}> <{if $block.show_comment == '1' && $item.cancomment && $item.comment != -1}> <{$item.comment}><{/if}> @@ -24,7 +24,7 @@ <{if $block.show_category == '1'}><{$item.categorylink}><{/if}> <{if $block.show_poster == '1'}><{$item.poster}><{/if}> - <{if $block.show_date == '1'}><{$item.date}><{/if}> + <{if $block.show_date == '1'}><{$item.date}><{/if}> <{/foreach}> @@ -35,4 +35,4 @@ -<{/if}> +<{/if}> diff --git a/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_spot.tpl b/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_spot.tpl index 9f8d5e08..8868d023 100644 --- a/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_spot.tpl +++ b/templates_bootstrap/bootstrap3/publisher/blocks/publisher_items_spot.tpl @@ -50,23 +50,23 @@ <{if $block.display_item_image}> <{if $item.image_path}>
    - <{$item.clean_title}> -
    + <{$item.clean_title}> +
    <{else}>
    - <{$item.clean_title}> -
    + <{$item.clean_title}> +
    <{/if}> <{/if}>
    <{$item.summary}> - <{if $block.display_adminlink}> -
    <{$item.adminlink}> - <{/if}> + <{if $block.display_adminlink}> +
    <{$item.adminlink}> + <{/if}>
    <{if $block.truncate}> - <{if $block.display_readmore}> + <{if $block.display_readmore}> <{/if}> -
    +
    <{if $item.display_item_image}> - <{if $item.item_image != ''}> + <{if $item.item_image != ''}>
    <{$item.alt}>
    <{else}>
    - <{$item.alt}> -
    - <{/if}> + <{$item.alt}> +
    <{/if}> - + <{/if}> +

    <{$item.title}>

    <{if $item.poster}> - +   <{$item.poster}> - <{/if}> + <{/if}> <{if $item.posttime}> - +  <{$item.posttime}> - - <{/if}> + + <{/if}> <{if $item.read }> - +  <{$item.read}> <{$block.lang_reads}> - <{/if}> - <{if $item.comment && $item.cancomment && $item.comment != -1}> - + <{/if}> + <{if $item.comment && $item.cancomment && $item.comment != -1}> +  <{$item.comment}> - - <{/if}> + + <{/if}>
    <{if $item.display_summary}> - <{$item.text}> -
    + <{$item.text}> + - <{/if}> + <{/if}>
    <{if $op != 'preview'}> - - <{if $item.print }> - <{$item.print}> + + <{if $item.print }> + <{$item.print}> <{/if}> - <{if $item.pdf }> + <{if $item.pdf }> <{$item.pdf}> <{/if}> <{if $item.email}> @@ -72,7 +72,7 @@ <{if $item.display_adminlink}> <{$item.admin}> <{/if}> - + <{else}>   <{/if}> @@ -84,7 +84,7 @@ <{/foreach}> <{/section}> - <{if $block.latestnews_scroll }><{/if}> + <{if $block.latestnews_scroll }><{/if}>
    <{$block.morelink}><{$block.topiclink}><{$block.archivelink}><{$block.submitlink}>
    <{/if}> @@ -108,59 +108,59 @@ <{foreach item=item from=$block.columns[i]}> <{/foreach}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_archive.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_archive.tpl index 10fc18a8..5e51fbca 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_archive.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_archive.tpl @@ -25,61 +25,61 @@

    <{$lang_articles}>

    <{foreach item=story from=$stories}> - +
    - <{if $showmainimage == 1}> - <{$story.cleantitle}>
    - <{/if}> -   

    <{$story.title}>

    - <{if $showsummary == 1}> -   <{$story.summary}>
    - <{/if}> + <{if $showmainimage == 1}> + <{$story.cleantitle}>
    + <{/if}> +   

    <{$story.title}>

    + <{if $showsummary == 1}> +   <{$story.summary}>
    + <{/if}> -
    - <{if $showcategory == 1}> - +
    + <{if $showcategory == 1}> +  <{$story.category}> - <{/if}> - <{if $showposter == 1}> + <{/if}> + <{if $showposter == 1}>  <{$story.author}> - <{/if}> - <{if $showdate == 1}> + <{/if}> + <{if $showdate == 1}>  <{$story.date}> - <{/if}> - <{if $showhits == 1}> - + <{/if}> + <{if $showhits == 1}> +  <{$story.counter}> <{$smarty.const._MD_PUBLISHER_READS}> - <{/if}> - <{if $showcomment == 1 && $story.cancomment && $story.comment != -1}> - + <{/if}> + <{if $showcomment == 1 && $story.cancomment && $story.comment != -1}> +  <{$story.comment}> - <{/if}> -
    -
    + <{/if}> +
    +
    - <{if $showpdfbutton == 1}> - <{$lang_pdf}> + <{if $showpdfbutton == 1}> + <{$lang_pdf}> <{/if}> - <{if $showprintlink == 1}> - <{$lang_printer}> + <{if $showprintlink == 1}> + <{$lang_printer}> <{/if}> - <{if $showemaillink == 1}> - + <{if $showemaillink == 1}> + <{/if}> -
    - -
    -
    - +
    + +
    +
    + <{/foreach}>
    - +

    <{$lang_storytotal}>
    <{/if}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_author_items.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_author_items.tpl index f4a15774..29412685 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_author_items.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_author_items.tpl @@ -12,7 +12,7 @@ <{foreach item=category from=$categories}> <{if $permRating && $displayrating}> - + <{else}> <{/if}> <{$category.link}> @@ -21,9 +21,9 @@ <{$smarty.const._CO_PUBLISHER_DATESUB}>  <{$smarty.const._CO_PUBLISHER_TITLE}> - <{if $displayhits}> + <{if $displayhits}> <{$smarty.const._MD_PUBLISHER_HITS}> - <{/if}> + <{/if}> <{if $permRating && $displayrating}>    <{$smarty.const._MD_PUBLISHER_VOTE_RATING}> <{/if}> @@ -32,23 +32,23 @@ <{$item.published}> - <{if $displaymainimage}> - <{$item.cleantitle}> - <{/if}> -   <{$item.link}> - <{if $displaysummary}> -
      <{$item.summary}> - <{/if}> - <{if $displaycomment && $item.cancomment && $item.comment != -1}> -
    - -    <{$item.comment}> - - <{/if}> - + <{if $displaymainimage}> + <{$item.cleantitle}> + <{/if}> +   <{$item.link}> + <{if $displaysummary}> +
      <{$item.summary}> + <{/if}> + <{if $displaycomment && $item.cancomment && $item.comment != -1}> +
    + +    <{$item.comment}> + + <{/if}> + <{if $displayhits}> - <{$item.hits}> - <{/if}> + <{$item.hits}> + <{/if}> <{if $permRating && $displayrating}>   <{$item.rating}> <{/if}> @@ -57,9 +57,9 @@
    <{$smarty.const._MD_PUBLISHER_TOTAL_ITEMS}><{$category.count_items}> <{if $displayhits}> -
    <{$smarty.const._MD_PUBLISHER_TOTAL_HITS}><{$category.count_hits}> +
    <{$smarty.const._MD_PUBLISHER_TOTAL_HITS}><{$category.count_hits}> <{/if}> - <{if $permRating && $displayrating}> + <{if $permRating && $displayrating}>   <{/if}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_display_list.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_display_list.tpl index 529cd498..d5cfd179 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_display_list.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_display_list.tpl @@ -17,62 +17,62 @@ <{if $items}> <{foreach item=item from=$items}>
    - <{if $display_mainimage == 1}> - <{if $item.image_path!=''}> + <{if $display_mainimage == 1}> + <{if $item.image_path!=''}>
    <{$item.title}>
    <{else}>
    - <{$item.title}> -
    - <{/if}> + <{$item.title}> +
    + <{/if}> <{/if}> - +

    <{$item.titlelink}>

    - <{if $show_subtitle && $item.subtitle}> + <{if $show_subtitle && $item.subtitle}> <{$item.subtitle}>
    <{/if}> - - <{if $display_category == 1}> - -  <{$item.category}> - - <{/if}> - <{if $display_poster == 1}> - -  <{$item.who}> - - <{/if}> - <{if $display_date_col == 1}> - -   <{$item.datesub}> - - <{/if}> - <{if $display_hits_col == 1}> - -   <{$item.counter}> - - <{/if}> + + <{if $display_category == 1}> + +  <{$item.category}> + + <{/if}> + <{if $display_poster == 1}> + +  <{$item.who}> + + <{/if}> + <{if $display_date_col == 1}> + +   <{$item.datesub}> + + <{/if}> + <{if $display_hits_col == 1}> + +   <{$item.counter}> + + <{/if}> <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> - -  <{$item.comments}> - - <{/if}> + +  <{$item.comments}> + + <{/if}> - +
    - <{if $display_summary == 1}> + <{if $display_summary == 1}>
    <{$item.summary}>
    <{/if}> - - <{if $display_readmore == 1}> - <{$smarty.const._MD_PUBLISHER_READMORE}>
    + + <{if $display_readmore == 1}> + <{$smarty.const._MD_PUBLISHER_READMORE}>
    <{/if}>
    diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_display_summary.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_display_summary.tpl index 3582cf06..594e92c5 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_display_summary.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_display_summary.tpl @@ -48,44 +48,44 @@ <{foreach item=item from=$items}> - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path!=''}> - <{$item.title}> - <{else}> - <{$item.title}> - <{/if}> - <{/if}> - <{$item.titlelink}> + <{$item.title}> + <{else}> + <{$item.title}> + <{/if}> + <{/if}> + <{$item.titlelink}> <{if $show_subtitle && $item.subtitle}>
    <{$item.subtitle}> <{/if}> - - -
    - <{if $display_summary == 1}><{$item.summary}>
    <{/if}> - <{if $display_readmore == 1}> -
    + + +
    + <{if $display_summary == 1}><{$item.summary}>
    <{/if}> + <{if $display_readmore == 1}> + <{/if}> - - <{if $display_category == 1}> - + + <{if $display_category == 1}> +    <{$item.category}> - <{/if}> - <{if $display_poster == 1}> + <{/if}> + <{if $display_poster == 1}>    <{$item.who}> <{/if}> - <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> - -    <{$item.comments}> - - <{/if}> - - + <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> + +    <{$item.comments}> + + <{/if}> + + <{if $display_date_col == 1}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_display_wfsection.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_display_wfsection.tpl index 693ab27a..a2ff9ace 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_display_wfsection.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_display_wfsection.tpl @@ -18,66 +18,66 @@ <{if $items}> <{foreach item=item from=$items}>
    - <{if $display_mainimage == 1}> - <{if $item.image_path!=''}> + <{if $display_mainimage == 1}> + <{if $item.image_path!=''}>
    <{$item.title}>
    <{else}>
    - <{$item.title}> -
    - <{/if}> + <{$item.title}> +
    <{/if}> - + <{/if}> +

    <{$item.titlelink}>

    - <{if $show_subtitle && $item.subtitle}> + <{if $show_subtitle && $item.subtitle}> <{$item.subtitle}> <{/if}> - +
    - <{if $display_summary == 1}> + <{if $display_summary == 1}>
    <{$item.summary}>
    <{/if}> - - <{if $display_readmore == 1}> - <{$smarty.const._MD_PUBLISHER_READMORE}>
    + + <{if $display_readmore == 1}> + <{$smarty.const._MD_PUBLISHER_READMORE}>
    <{/if}> - - <{if $display_category == 1}> - -  <{$item.category}> - - <{/if}> - <{if $display_poster == 1}> - -  <{$item.who}> - - <{/if}> - <{if $display_date_col == 1}> - -   <{$item.datesub}> - - <{/if}> - <{if $display_hits_col == 1}> - -   <{$item.counter}> - - <{/if}> + + <{if $display_category == 1}> + +  <{$item.category}> + + <{/if}> + <{if $display_poster == 1}> + +  <{$item.who}> + + <{/if}> + <{if $display_date_col == 1}> + +   <{$item.datesub}> + + <{/if}> + <{if $display_hits_col == 1}> + +   <{$item.counter}> + + <{/if}> <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> - -  <{$item.comments}> - + +  <{$item.comments}> + <{/if}> - - + +
    diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl index d4b42fe7..d0381ab0 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl @@ -23,12 +23,12 @@ <{include file='db:publisher_header.tpl'}> - + <{if $item.image_path==''}> - <{if $display_defaultimage}> - <{$item.title}> - <{/if}> - <{/if}> + <{if $display_defaultimage}> + <{$item.title}> + <{/if}> + <{/if}> <{if $item.image_path || $item.images}>
    <{if $item.images}> @@ -50,7 +50,7 @@

    <{$item.title}> -
    +
    <{if $display_itemcategory}>  <{$item.category}> @@ -76,15 +76,15 @@  <{$item.counter}> <{$smarty.const._MD_PUBLISHER_READS}> <{/if}> -
    -

    +
    + <{if $show_subtitle && $item.subtitle}>
    <{$item.subtitle}>
    <{/if}> - - + + <{$item.maintext}>
    @@ -219,36 +219,36 @@ <{foreach item=item from=$items}> - <{if $show_mainimage == 1}> - <{if $item.item_image==''}> - <{$item.title}> - <{else}> - <{$item.title}> + <{if $show_mainimage == 1}> + <{if $item.item_image==''}> + <{$item.title}> + <{else}> + <{$item.title}> <{/if}> - <{/if}> + <{/if}> <{$item.titlelink}> - <{if $show_summary == 1}> + <{if $show_summary == 1}>
    <{$item.summary}>
    <{/if}> - <{if $show_readmore == 1}> -
    + <{if $show_readmore == 1}> + <{/if}> - <{if $display_category == 1}> - + <{if $display_category == 1}> +    <{$item.category}> - <{/if}> - <{if $show_poster == 1}> + <{/if}> + <{if $show_poster == 1}> -    <{$item.who}> - +    <{$item.who}> + <{/if}> - <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> + <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> -    <{$item.comments}> - +    <{$item.comments}> + <{/if}> <{if $show_date_col == 1}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl index 4ff742b1..9ad7aba3 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl @@ -59,10 +59,10 @@ <{/if}> <{if $item.image_path==''}> - <{if $display_defaultimage}> - <{$item.title}> - <{/if}> - <{/if}> + <{if $display_defaultimage}> + <{$item.title}> + <{/if}> + <{/if}> <{if $item.image_path || $item.images}>
    <{if $item.images}> @@ -216,36 +216,36 @@ <{foreach item=item from=$items}> - <{if $show_mainimage == 1}> - <{if $item.item_image==''}> - <{$item.title}> - <{else}> - <{$item.title}> + <{if $show_mainimage == 1}> + <{if $item.item_image==''}> + <{$item.title}> + <{else}> + <{$item.title}> <{/if}> - <{/if}> + <{/if}> <{$item.titlelink}> - <{if $show_summary == 1}> + <{if $show_summary == 1}>
    <{$item.summary}>
    <{/if}> - <{if $show_readmore == 1}> -
    + <{if $show_readmore == 1}> + <{/if}> - <{if $display_category == 1}> - + <{if $display_category == 1}> +  <{$item.category}> - <{/if}> - <{if $show_poster == 1}> + <{/if}> + <{if $show_poster == 1}> -    <{$item.who}> - +    <{$item.who}> + <{/if}> - <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> + <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> -    <{$item.comments}> - +    <{$item.comments}> + <{/if}> <{if $show_date_col == 1}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_singleitem.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_singleitem.tpl index a1d818d6..f5ee5f71 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_singleitem.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_singleitem.tpl @@ -4,19 +4,19 @@ <{$item.category}>
    <{/if}> - - <{if $display_mainimage == 1}> - <{if $item.image_path!=''}> + + <{if $display_mainimage == 1}> + <{if $item.image_path!=''}>
    <{$item.title}>
    <{else}>
    - <{$item.title}> -
    - <{/if}> + <{$item.title}> +
    + <{/if}> <{/if}> - +

    <{$item.titlelink}>

    <{if $show_subtitle && $item.subtitle}> @@ -25,7 +25,7 @@ <{if $display_category == 1}>  <{$item.category}> - <{/if}> + <{/if}> <{if $display_poster == 1}>  <{$item.who}> <{/if}> @@ -47,11 +47,10 @@ <{/if}> <{if $display_readmore == 1}> -
    - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_singleitem_block.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_singleitem_block.tpl index ee2c8f97..1414b1f1 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_singleitem_block.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_singleitem_block.tpl @@ -14,11 +14,11 @@
    <{else}>
    - + <{$item.title}> -
    - <{/if}> +
    + <{/if}>

    <{$item.titlelink}>

    @@ -48,20 +48,20 @@
    <{$item.summary}> <{if $block.truncate}> - <{if $block.display_readmore}> -
    + <{if $block.display_readmore}> + <{/if}> - <{/if}> + <{/if}>
    <{if $op != 'preview'}> <{if $block.display_adminlink}> - <{$item.adminlink}> - <{/if}> + <{$item.adminlink}> + <{/if}> <{else}>   <{/if}> diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_new.tpl b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_new.tpl index 56cfc278..36b45df5 100644 --- a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_new.tpl +++ b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_new.tpl @@ -9,7 +9,7 @@ <{/if}> <{$newitems.link}> - <{if $block.show_order == '1'}> + <{if $block.show_order == '1'}> (<{$newitems.new}>) <{/if}>
    diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_random_item.tpl b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_random_item.tpl index 30163e19..25700dcd 100644 --- a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_random_item.tpl +++ b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_random_item.tpl @@ -1,36 +1,36 @@ <{foreach item=items from=$block.items}> <{if $block.display_item_image == '1'}> - <{$block.alt}> + <{$block.alt}> <{/if}> <{$block.titlelink}>
    <{if $block.display_summary == '1'}> <{$block.content}>
    - <{/if}> + <{/if}> <{if $block.display_categorylink == '1'}>  <{$block.categorylink}> - <{/if}> - <{if $block.display_poster == '1'}> + <{/if}> + <{if $block.display_poster == '1'}>  <{$block.poster}> - <{/if}> - <{if $block.display_date == '1'}> + <{/if}> + <{if $block.display_date == '1'}>  <{$block.date}> - <{/if}> - <{if $block.display_comment == '1' && $block.cancomment && $block.comment != -1}> + <{/if}> + <{if $block.display_comment == '1' && $block.cancomment && $block.comment != -1}>  <{$block.comment}> - <{/if}> - <{if $block.display_hits == '1'}> + <{/if}> + <{if $block.display_hits == '1'}>  <{$block.hits}> <{$block.lang_hits}> - <{/if}> + <{/if}> <{if $block.display_lang_fullitem == '1'}> diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_recent.tpl b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_recent.tpl index 2fe8ff0a..4ceefe0a 100644 --- a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_recent.tpl +++ b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_recent.tpl @@ -11,14 +11,14 @@ <{foreach item=item from=$block.items}> - <{if $block.show_image == '1'}> - <{$item.alt}>
    + <{if $block.show_image == '1'}> + <{$item.alt}>
    <{/if}> - <{$item.itemlink}> - + <{$item.itemlink}> + <{if $block.show_category == '1'}><{$item.categorylink}><{/if}> <{if $block.show_date == '1'}><{$item.date}><{/if}> - <{if $block.show_poster == '1'}><{$item.poster}><{/if}> + <{if $block.show_poster == '1'}><{$item.poster}><{/if}> <{/foreach}> diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_spot.tpl b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_spot.tpl index eee7ed21..48e57639 100644 --- a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_spot.tpl +++ b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_items_spot.tpl @@ -20,30 +20,30 @@

    <{$item.titlelink}>

    <{if $block.display_categorylink}> - +  <{$item.category}> - <{/if}> - <{if $block.display_who_link}> + <{/if}> + <{if $block.display_who_link}>  <{$item.who}> - <{/if}> - <{if $block.display_when_link}> - + <{/if}> + <{if $block.display_when_link}> +  <{$item.when}> - <{/if}> - <{if $block.display_reads}> - + <{/if}> + <{if $block.display_reads}> +  <{$item.counter}> <{$block.lang_reads}> - <{/if}> + <{/if}> <{if $block.display_comment_link && $item.cancomment && $item.comments != -1}> - +  <{$item.comments}> - <{/if}> + <{/if}>
    <{if $item.image_path}>
    @@ -52,20 +52,20 @@ <{/if}>
    <{$item.summary}> - <{if $block.display_adminlink}> -
    <{$item.adminlink}> - <{/if}> + <{if $block.display_adminlink}> +
    <{$item.adminlink}> + <{/if}>
    <{if $block.truncate}> - <{if $block.display_readmore}> + <{if $block.display_readmore}> <{/if}> - <{/if}> + <{/if}>
    <{/if}> diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_latest_news.tpl b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_latest_news.tpl index 8afb77c6..f50997ae 100644 --- a/templates_bootstrap/bootstrap4/publisher/blocks/publisher_latest_news.tpl +++ b/templates_bootstrap/bootstrap4/publisher/blocks/publisher_latest_news.tpl @@ -10,60 +10,60 @@ <{$item.category}>
    <{/if}> -
    +
    <{if $item.display_item_image}> - <{if $item.item_image != ''}> + <{if $item.item_image != ''}>
    <{$item.alt}>
    <{else}>
    - <{$item.alt}> -
    - <{/if}> + <{$item.alt}> +
    <{/if}> - + <{/if}> +

    <{$item.title}>

    <{if $item.poster}> - +   <{$item.poster}> - <{/if}> + <{/if}> <{if $item.posttime}> - +  <{$item.posttime}> - - <{/if}> + + <{/if}> <{if $item.read}> - +  <{$item.read}> <{$block.lang_reads}> - <{/if}> - <{if $item.comment && $item.cancomment && $item.comment != -1}> - + <{/if}> + <{if $item.comment && $item.cancomment && $item.comment != -1}> +  <{$item.comment}> - - <{/if}> + + <{/if}>
    <{if $item.display_summary}> - <{$item.text}> -
    + <{$item.text}> + - <{/if}> + <{/if}>
    <{if $op != 'preview'}> - - <{if $item.print }> - <{$item.print}> + + <{if $item.print }> + <{$item.print}> <{/if}> - <{if $item.pdf }> + <{if $item.pdf }> <{$item.pdf}> <{/if}> <{if $item.email}> @@ -72,7 +72,7 @@ <{if $item.display_adminlink}> <{$item.admin}> <{/if}> - + <{else}>   <{/if}> @@ -84,7 +84,7 @@ <{/foreach}> <{/section}> - <{if $block.latestnews_scroll }><{/if}> + <{if $block.latestnews_scroll }><{/if}>
    <{$block.morelink}><{$block.topiclink}><{$block.archivelink}><{$block.submitlink}>
    <{/if}> @@ -108,59 +108,59 @@ <{foreach item=item from=$block.columns[i]}> <{/foreach}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_archive.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_archive.tpl index 0eea0539..9837ebd3 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_archive.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_archive.tpl @@ -25,61 +25,61 @@

    <{$lang_articles}>

    <{foreach item=story from=$stories}> - + - <{if $showmainimage == 1}> - <{$story.cleantitle}>
    - <{/if}> -   

    <{$story.title}>


    - <{if $showsummary == 1}> -   <{$story.summary}>
    - <{/if}> + <{if $showmainimage == 1}> + <{$story.cleantitle}>
    + <{/if}> +   

    <{$story.title}>


    + <{if $showsummary == 1}> +   <{$story.summary}>
    + <{/if}> -
    - <{if $showcategory == 1}> - +
    + <{if $showcategory == 1}> +  <{$story.category}> - <{/if}> - <{if $showposter == 1}> + <{/if}> + <{if $showposter == 1}>  <{$story.author}> - <{/if}> - <{if $showdate == 1}> + <{/if}> + <{if $showdate == 1}>  <{$story.date}> - <{/if}> - <{if $showhits == 1}> - + <{/if}> + <{if $showhits == 1}> +  <{$story.counter}> <{$smarty.const._MD_PUBLISHER_READS}> - <{/if}> - <{if $showcomment == 1 && $story.cancomment && $story.comment != -1}> - + <{/if}> + <{if $showcomment == 1 && $story.cancomment && $story.comment != -1}> +  <{$story.comment}> - <{/if}> -
    -
    + <{/if}> +
    +
    - <{if $showpdfbutton == 1}> - <{$lang_pdf}> + <{if $showpdfbutton == 1}> + <{$lang_pdf}> <{/if}> - <{if $showprintlink == 1}> - <{$lang_printer}> + <{if $showprintlink == 1}> + <{$lang_printer}> <{/if}> - <{if $showemaillink == 1}> - + <{if $showemaillink == 1}> + <{/if}> -
    - -
    -
    - +
    + +
    +
    + <{/foreach}>
    - +

    <{$lang_storytotal}>
    <{/if}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_author_items.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_author_items.tpl index 87be4914..77ca13c4 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_author_items.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_author_items.tpl @@ -12,7 +12,7 @@ <{foreach item=category from=$categories}> <{if $permRating && $displayrating}> - + <{else}> <{/if}> <{$category.link}> @@ -21,9 +21,9 @@ <{$smarty.const._CO_PUBLISHER_DATESUB}>  <{$smarty.const._CO_PUBLISHER_TITLE}> - <{if $displayhits}> + <{if $displayhits}> <{$smarty.const._MD_PUBLISHER_HITS}> - <{/if}> + <{/if}> <{if $permRating && $displayrating}>    <{$smarty.const._MD_PUBLISHER_VOTE_RATING}> <{/if}> @@ -32,23 +32,23 @@ <{$item.published}> - <{if $displaymainimage}> - <{$item.cleantitle}> - <{/if}> -   <{$item.link}> - <{if $displaysummary}> -
      <{$item.summary}> - <{/if}> - <{if $displaycomment && $item.cancomment && $item.comment != -1}> -
    - -    <{$item.comment}> - - <{/if}> - + <{if $displaymainimage}> + <{$item.cleantitle}> + <{/if}> +   <{$item.link}> + <{if $displaysummary}> +
      <{$item.summary}> + <{/if}> + <{if $displaycomment && $item.cancomment && $item.comment != -1}> +
    + +    <{$item.comment}> + + <{/if}> + <{if $displayhits}> - <{$item.hits}> - <{/if}> + <{$item.hits}> + <{/if}> <{if $permRating && $displayrating}>   <{$item.rating}> <{/if}> @@ -57,9 +57,9 @@
    <{$smarty.const._MD_PUBLISHER_TOTAL_ITEMS}><{$category.count_items}> <{if $displayhits}> -
    <{$smarty.const._MD_PUBLISHER_TOTAL_HITS}><{$category.count_hits}> +
    <{$smarty.const._MD_PUBLISHER_TOTAL_HITS}><{$category.count_hits}> <{/if}> - <{if $permRating && $displayrating}> + <{if $permRating && $displayrating}>   <{/if}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_display_full.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_display_full.tpl index 6363e0ea..59de6eb8 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_display_full.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_display_full.tpl @@ -22,57 +22,57 @@
    <{foreach item=item from=$items}>
    - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path!=''}> ` - <{$item.title}> - <{else}> - - <{$item.title}> - <{/if}> - <{/if}> - - + <{$item.title}> + <{else}> + + <{$item.title}> + <{/if}> + <{/if}> + +
    <{$item.titlelink}>
    <{if $show_subtitle && $item.subtitle}>

    <{$item.subtitle}>

    <{/if}> -

    +

    <{if $display_poster == 1}> <{$item.who}> <{/if}> - <{if $display_poster == 1}> + <{if $display_poster == 1}> <{$item.when}> <{/if}> - <{if $display_poster == 1}> + <{if $display_poster == 1}> (<{$item.counter}> <{$smarty.const._MD_PUBLISHER_READS}>) <{/if}> -

    - <{if $display_summary == 1}> +

    + <{if $display_summary == 1}> <{if $indexpage|default:false}>

    <{$item.summary}>

    <{else}>

    <{$item.summary|truncateHtml:80}>

    <{/if}> - <{/if}> - - <{if $display_category == 1}> - + <{/if}> + + <{if $display_category == 1}> +    <{$item.category}> - <{/if}> - <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> - -    <{$item.comments}> - - <{/if}> - + <{/if}> + <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> + +    <{$item.comments}> + + <{/if}> + <{if $display_readmore == 1}> - <{/if}> + <{/if}>
    <{/foreach}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_display_list.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_display_list.tpl index 63dbed53..2d771a2d 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_display_list.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_display_list.tpl @@ -16,65 +16,65 @@ <{if $items}> <{foreach item=item from=$items}>
    - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path}>
    <{$item.title}>
    - <{else}> + <{else}>
    - - <{$item.title}> - -
    + + <{$item.title}> + +
    <{/if}> - <{/if}> + <{/if}>

    <{$item.titlelink}>

    <{if $display_category == 1}> - -  <{$item.category}> - - <{/if}> - <{if $display_poster == 1}> - -  <{$item.who}> - - <{/if}> - <{if $display_date_col == 1}> - -   <{$item.datesub}> - - <{/if}> - <{if $display_hits_col == 1}> - -   <{$item.counter}> - - <{/if}> + +  <{$item.category}> + + <{/if}> + <{if $display_poster == 1}> + +  <{$item.who}> + + <{/if}> + <{if $display_date_col == 1}> + +   <{$item.datesub}> + + <{/if}> + <{if $display_hits_col == 1}> + +   <{$item.counter}> + + <{/if}> <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> - -  <{$item.comments}> - - <{/if}> + +  <{$item.comments}> + + <{/if}>
    - <{if $display_summary == 1}> + <{if $display_summary == 1}> <{if $indexpage|default:false}>

    <{$item.summary}>

    <{else}>

    <{$item.summary|truncateHtml:80}>

    <{/if}> - <{/if}> + <{/if}>
    - - <{if $display_readmore == 1}> + + <{if $display_readmore == 1}> - <{/if}> + <{/if}>
    <{/foreach}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_display_summary.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_display_summary.tpl index 3582cf06..594e92c5 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_display_summary.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_display_summary.tpl @@ -48,44 +48,44 @@ <{foreach item=item from=$items}> - <{if $display_mainimage == 1}> + <{if $display_mainimage == 1}> <{if $item.image_path!=''}> - <{$item.title}> - <{else}> - <{$item.title}> - <{/if}> - <{/if}> - <{$item.titlelink}> + <{$item.title}> + <{else}> + <{$item.title}> + <{/if}> + <{/if}> + <{$item.titlelink}> <{if $show_subtitle && $item.subtitle}>
    <{$item.subtitle}> <{/if}> - - -
    - <{if $display_summary == 1}><{$item.summary}>
    <{/if}> - <{if $display_readmore == 1}> -
    + + +
    + <{if $display_summary == 1}><{$item.summary}>
    <{/if}> + <{if $display_readmore == 1}> + <{/if}> - - <{if $display_category == 1}> - + + <{if $display_category == 1}> +    <{$item.category}> - <{/if}> - <{if $display_poster == 1}> + <{/if}> + <{if $display_poster == 1}>    <{$item.who}> <{/if}> - <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> - -    <{$item.comments}> - - <{/if}> - - + <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> + +    <{$item.comments}> + + <{/if}> + + <{if $display_date_col == 1}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_display_wfsection.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_display_wfsection.tpl index 8eba0ff7..3f60c52f 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_display_wfsection.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_display_wfsection.tpl @@ -21,63 +21,63 @@

    <{$item.titlelink}>

    - <{if $display_mainimage == 1}> - <{if $item.image_path!=''}> + <{if $display_mainimage == 1}> + <{if $item.image_path!=''}>
    <{$item.title}>
    <{else}>
    - <{$item.title}> -
    - <{/if}> + <{$item.title}> +
    <{/if}> - - - <{if $display_summary == 1}> + <{/if}> + + + <{if $display_summary == 1}>
    <{$item.summary}>
    - <{/if}> - <{if $display_readmore == 1}> + <{/if}> + <{if $display_readmore == 1}> - <{/if}> + <{/if}>
    - - <{if $display_category == 1}> - -  <{$item.category}> - - <{/if}> - <{if $display_poster == 1}> - -  <{$item.who}> - - <{/if}> - <{if $display_date_col == 1}> - -   <{$item.datesub}> - - <{/if}> - <{if $display_hits_col == 1}> - -   <{$item.counter}> - - <{/if}> + + <{if $display_category == 1}> + +  <{$item.category}> + + <{/if}> + <{if $display_poster == 1}> + +  <{$item.who}> + + <{/if}> + <{if $display_date_col == 1}> + +   <{$item.datesub}> + + <{/if}> + <{if $display_hits_col == 1}> + +   <{$item.counter}> + + <{/if}> <{if $display_commentlink == 1 && $item.cancomment && $item.comments != -1}> - -  <{$item.comments}> - - <{/if}> - + +  <{$item.comments}> + + <{/if}> +
    - <{/foreach}> + <{/foreach}>
    diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl index fe11b350..d9dad61b 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl @@ -3,42 +3,42 @@

    <{$item.titlelink}> - <{if $display_itemcategory}> + <{if $display_itemcategory}>  <{$item.category}> - <{/if}> - <{if $display_who_link}> + <{/if}> + <{if $display_who_link}>  <{$item.who}> - <{/if}> - <{if $display_when_link}> + <{/if}> + <{if $display_when_link}>  <{$item.when}> - <{/if}> - <{if $display_comment_link && $item.cancomment && $item.comments != -1}> + <{/if}> + <{if $display_comment_link && $item.cancomment && $item.comments != -1}>  <{$item.comments}> - <{/if}> - <{if $display_hits_link}> + <{/if}> + <{if $display_hits_link}>  <{$item.counter}> <{$smarty.const._MD_PUBLISHER_READS}> - <{/if}> + <{/if}>

    <{if $show_subtitle && $item.subtitle}>
    <{$item.subtitle}>
    <{/if}>
    - <{if $item.image_path==''}> - <{if $display_defaultimage}> - <{$item.title}> - <{/if}> - <{/if}> + <{if $item.image_path==''}> + <{if $display_defaultimage}> + <{$item.title}> + <{/if}> + <{/if}> <{if $item.image_path || $item.images}>
    <{if $item.images}> @@ -98,7 +98,7 @@
    <{/if}>
    - <{if $display_print_link}> + <{if $display_print_link}> <{$item.printlink}> <{/if}> <{if $display_pdf_button}> @@ -206,38 +206,38 @@ <{foreach item=item from=$items}> - <{if $show_mainimage == 1}> - <{if $item.item_image==''}> - <{$item.title}> - <{else}> - <{$item.title}> + <{if $show_mainimage == 1}> + <{if $item.item_image==''}> + <{$item.title}> + <{else}> + <{$item.title}> <{/if}> - <{/if}> - <{$item.titlelink}> - <{if $show_summary == 1}> + <{/if}> + <{$item.titlelink}> + <{if $show_summary == 1}>
    <{$item.summary}>
    <{/if}> - <{if $show_readmore == 1}> -
    + <{if $show_readmore == 1}> + <{/if}> - <{if $display_category == 1}> - + <{if $display_category == 1}> +  <{$item.category}> - <{/if}> - <{if $show_poster == 1}> + <{/if}> + <{if $show_poster == 1}> -    <{$item.who}> - +    <{$item.who}> + <{/if}> - <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> + <{if $show_commentlink == 1 && $item.cancomment && $item.comments != -1}> -    <{$item.comments}> - +    <{$item.comments}> + <{/if}> - + <{if $display_date_col == 1}> <{$item.datesub}> <{/if}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_singleitem_block.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_singleitem_block.tpl index 42c70f52..bcfa4bba 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_singleitem_block.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_singleitem_block.tpl @@ -12,10 +12,10 @@
    <{else}>
    - + <{$item.title}> -
    +
    <{/if}>

    <{$item.titlelink}>

    @@ -44,21 +44,21 @@
    <{$item.summary}> - <{if $block.truncate}> - <{if $block.display_readmore}> -
    + <{if $block.truncate}> + <{if $block.display_readmore}> + <{/if}> - <{/if}> + <{/if}>
    <{if $op != 'preview'}> <{if $block.display_adminlink}> - <{$item.adminlink}> - <{/if}> + <{$item.adminlink}> + <{/if}> <{else}>   <{/if}> diff --git a/testdata/english/group_permission.yml b/testdata/english/group_permission.yml new file mode 100644 index 00000000..b79af31e --- /dev/null +++ b/testdata/english/group_permission.yml @@ -0,0 +1,405 @@ +- + gperm_groupid: '1' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: category_moderation +- + gperm_groupid: '1' + gperm_itemid: '6' + gperm_modid: '334' + gperm_name: category_moderation +- + gperm_groupid: '1' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: category_moderation +- + gperm_groupid: '1' + gperm_itemid: '3' + gperm_modid: '334' + gperm_name: category_moderation +- + gperm_groupid: '1' + gperm_itemid: '2' + gperm_modid: '334' + gperm_name: category_moderation +- + gperm_groupid: '1' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: category_moderation +- + gperm_groupid: '1' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '1' + gperm_itemid: '2' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '3' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '3' + gperm_itemid: '6' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '3' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '1' + gperm_itemid: '3' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '1' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '1' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '1' + gperm_itemid: '6' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '2' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '2' + gperm_itemid: '2' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '2' + gperm_itemid: '3' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '2' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '2' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '2' + gperm_itemid: '6' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '3' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '3' + gperm_itemid: '2' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '3' + gperm_itemid: '3' + gperm_modid: '334' + gperm_name: category_read +- + gperm_groupid: '1' + gperm_itemid: '81600' + gperm_modid: '334' + gperm_name: editors +- + gperm_groupid: '1' + gperm_itemid: '6017' + gperm_modid: '334' + gperm_name: editors +- + gperm_groupid: '1' + gperm_itemid: '3606' + gperm_modid: '334' + gperm_name: editors +- + gperm_groupid: '2' + gperm_itemid: '10' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '26' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '8' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '9' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '12' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '24' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '7' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '12' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '14' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '19' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '23' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '25' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '8' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '25' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '15' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '20' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '18' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '24' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '9' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '26' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '13' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '18' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '21' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '22' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '23' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '11' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '19' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '15' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '14' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '20' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '21' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '22' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '3' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '10' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '11' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '7' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '3' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: form_view +- + gperm_groupid: '1' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: global +- + gperm_groupid: '1' + gperm_itemid: '2' + gperm_modid: '334' + gperm_name: global +- + gperm_groupid: '1' + gperm_itemid: '1' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '1' + gperm_itemid: '2' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '1' + gperm_itemid: '3' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '2' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '1' + gperm_itemid: '4' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '2' + gperm_itemid: '6' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '1' + gperm_itemid: '6' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '1' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: item_submit +- + gperm_groupid: '2' + gperm_itemid: '5' + gperm_modid: '334' + gperm_name: item_submit diff --git a/testdata/english/publisher_items.yml b/testdata/english/publisher_items.yml index 84e5b0e0..2b88f4aa 100644 --- a/testdata/english/publisher_items.yml +++ b/testdata/english/publisher_items.yml @@ -181,13 +181,13 @@ - itemid: '7' categoryid: '5' - title: 'Test DI' + title: 'Test Expiration Date' subtitle: '' - summary: '

    sth st hsth

    ' - body: '

    tnhsnth sthstnh th

    ' + 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: '1549672800' + datesub: '1738378800' dateexpire: '0' status: '2' image: '4' @@ -206,15 +206,15 @@ notifypub: '0' meta_keywords: 'Test,hsth' meta_description: 'sth st hsth' - short_url: '' + short_url: test-di item_tag: '' - itemid: '8' categoryid: '5' title: 'Test DI FUTURE' subtitle: '' - summary: '

    sth st hsth tnh sthsthsnthntsh

    ' - body: '

    tnhsnth sthstnh th

    ' + 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: '1553701200' @@ -236,15 +236,15 @@ notifypub: '0' meta_keywords: 'Test,hsth' meta_description: 'sth st hsth' - short_url: '' + short_url: test-di-future item_tag: '' - itemid: '9' categoryid: '5' - title: 'Test DI thnhnth snth ntshnsthnt' + title: 'Test DI' subtitle: '' - summary: '

    sth st hsth tnh sthsthsnthntsh

    ' - body: '

    tnhsnth sthstnh th

    ' + 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: '1551368400' @@ -266,7 +266,7 @@ notifypub: '0' meta_keywords: 'Test,hsth' meta_description: 'sth st hsth' - short_url: '' + short_url: test-di item_tag: '' - itemid: '10' diff --git a/testdata/index.php b/testdata/index.php index 1a9fe2e4..62b6299e 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -12,30 +12,32 @@ * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) - * @package * @since 2.5.9 * @author Michael Beck (aka Mamba) */ -use XoopsModules\Publisher; -use XoopsModules\Publisher\Common; -use XoopsModules\Publisher\Utility; +use \Xmf\Request; +use XoopsModules\Publisher\{ + Helper, + Common, + Utility +}; -require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; +require_once dirname(__DIR__, 3) . '/include/cp_header.php'; require dirname(__DIR__) . '/preloads/autoloader.php'; -$op = \Xmf\Request::getCmd('op', ''); +$op = Request::getCmd('op', ''); $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -$helper = Publisher\Helper::getInstance(); +$helper = Helper::getInstance(); // Load language files $helper->loadLanguage('common'); switch ($op) { case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header('../admin/index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } @@ -59,7 +61,7 @@ function loadSampleData() $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $utility = new Publisher\Utility(); + $utility = new Utility(); $configurator = new Common\Configurator(); $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); @@ -69,12 +71,19 @@ function loadSampleData() $language = $xoopsConfig['language'] . '/'; } + // load module tables foreach ($tables as $table) { $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); \Xmf\Database\TableLoad::truncateTable($table); \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); } + // load permissions + $table = 'group_permission'; + $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); + $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); + loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); + // --- COPY test folder files --------------- if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) { // $file = dirname(__DIR__) . '/testdata/images/'; @@ -102,10 +111,18 @@ function saveSampleData() $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; Utility::createFolder($exportFolder); + // save module tables foreach ($tables as $table) { \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); } + // save permissions + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('gperm_modid', \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'))); + $skipColumns[] = 'gperm_id'; + \Xmf\Database\TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); + unset($criteria); + redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); } @@ -116,11 +133,66 @@ function exportSchema() try { // TODO set exportSchema - // $migrate = new Publisher\Migrate($moduleDirName); + // $migrate = new Migrate($moduleDirName); // $migrate->saveCurrentSchema(); // // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); - } catch (\Exception $e) { + } catch (\Throwable $e) { exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); } } + +/** + * loadTableFromArrayWithReplace + * + * @param string $table value with should be used insead of original value of $search + * + * @param array $data array of rows to insert + * Each element of the outer array represents a single table row. + * Each row is an associative array in 'column' => 'value' format. + * @param string $search name of column for which the value should be replaced + * @param $replace + * @return int number of rows inserted + */ +function loadTableFromArrayWithReplace($table, $data, $search, $replace) +{ + /** @var \XoopsMySQLDatabase $db */ + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + + $prefixedTable = $db->prefix($table); + $count = 0; + + $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); + + $result = $db->queryF($sql); + + foreach ($data as $row) { + $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; + $valueClause = ' VALUES ('; + $first = true; + foreach ($row as $column => $value) { + if ($first) { + $first = false; + } else { + $insertInto .= ', '; + $valueClause .= ', '; + } + + $insertInto .= $column; + if ($search === $column) { + $valueClause .= $db->quote($replace); + } else { + $valueClause .= $db->quote($value); + } + } + + $sql = $insertInto . ') ' . $valueClause . ')'; + + $result = $db->queryF($sql); + if (false !== $result) { + ++$count; + } + } + + return $count; +} diff --git a/thumb.php b/thumb.php index 271a1019..d7e23ecc 100644 --- a/thumb.php +++ b/thumb.php @@ -232,8 +232,8 @@ } //ADVANCED: Enable this if you've got Xvfb running in the background. // If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains. -if (!isset($ALLOWED_SITES)) { - $ALLOWED_SITES = [ +if (!isset($allowedSites)) { + $allowedSites = [ 'flickr.com', 'staticflickr.com', 'picasa.com', @@ -298,7 +298,7 @@ public static function start() public function __construct() { - global $ALLOWED_SITES; + global $allowedSites; $this->startTime = microtime(true); date_default_timezone_set('UTC'); $this->debug(1, 'Starting new request from ' . $this->getIP() . ' to ' . Request::getString('REQUEST_URI', '', 'SERVER')); @@ -367,14 +367,14 @@ public function __construct() } else { $this->debug(2, 'Fetching only from selected external sites is enabled.'); $allowed = false; - foreach ($ALLOWED_SITES as $site) { + foreach ($allowedSites as $site) { if ((mb_strtolower($this->url['host']) === mb_strtolower($site)) || (mb_strtolower(mb_substr($this->url['host'], -mb_strlen($site) - 1)) === mb_strtolower(".$site"))) { $this->debug(3, "URL hostname {$this->url['host']} matches $site so allowing."); $allowed = true; } } if (!$allowed) { - return $this->error('You may not fetch images from that site. To enable this site in timthumb, you can either add it to $ALLOWED_SITES and set ALLOW_EXTERNAL=true. Or you can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs.'); + return $this->error('You may not fetch images from that site. To enable this site in timthumb, you can either add it to $allowedSites and set ALLOW_EXTERNAL=true. Or you can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs.'); } } } @@ -718,7 +718,7 @@ protected function processImageAndWriteToCache($localImage) // get standard input properties $newWidth = (int)abs($this->param('w', 0)); $newHeight = (int)abs($this->param('h', 0)); - $zoom_crop = (int)$this->param('zc', DEFAULT_ZC); + $zoomCrop = (int)$this->param('zc', DEFAULT_ZC); $quality = (int)abs($this->param('q', DEFAULT_Q)); $align = $this->cropTop ? 't' : $this->param('a', 'c'); $filters = $this->param('f', DEFAULT_F); @@ -759,7 +759,7 @@ protected function processImageAndWriteToCache($localImage) } // scale down and add borders - if (3 == $zoom_crop) { + if (3 == $zoomCrop) { $final_height = $height * ($newWidth / $width); if ($final_height > $newHeight) { @@ -796,7 +796,7 @@ protected function processImageAndWriteToCache($localImage) // Completely fill the background of the new image with allocated color. imagefill($canvas, 0, 0, $color); // scale down and add borders - if (2 == $zoom_crop) { + if (2 == $zoomCrop) { $final_height = $height * ($newWidth / $width); if ($final_height > $newHeight) { $origin_x = $newWidth / 2; @@ -812,7 +812,7 @@ protected function processImageAndWriteToCache($localImage) // Restore transparency blending imagesavealpha($canvas, true); - if ($zoom_crop > 0) { + if ($zoomCrop > 0) { $src_x = $src_y = 0; $src_w = $width; $src_h = $height; @@ -1299,7 +1299,7 @@ protected function sendImageHeaders($mimeType, $dataSize) if ('image/jpg' === mb_strtolower($mimeType)) { $mimeType = 'image/jpeg'; } - $gmdate_expires = gmdate('D, d M Y H:i:s', strtotime('now +10 days')) . ' GMT'; + $gmdateExpires = gmdate('D, d M Y H:i:s', strtotime('now +10 days')) . ' GMT'; $gmdate_modified = gmdate('D, d M Y H:i:s') . ' GMT'; // send content headers then display image header('Content-Type: ' . $mimeType); @@ -1314,7 +1314,7 @@ protected function sendImageHeaders($mimeType, $dataSize) } else { $this->debug(3, 'Browser caching is enabled'); header('Cache-Control: max-age=' . BROWSER_CACHE_MAX_AGE . ', must-revalidate'); - header('Expires: ' . $gmdate_expires); + header('Expires: ' . $gmdateExpires); } return true; @@ -1458,28 +1458,28 @@ protected function setMemoryLimit() } /** - * @param $size_str + * @param $sizeString * * @return int */ - protected static function returnBytes($size_str) + protected static function returnBytes($sizeString) { - switch (mb_substr($size_str, -1)) { + switch (mb_substr($sizeString, -1)) { case 'M': case 'm': - return (int)$size_str * 1048576; + return (int)$sizeString * 1048576; case 'K': case 'k': - return (int)$size_str * 1024; + return (int)$sizeString * 1024; case 'G': case 'g': - return (int)$size_str * 1073741824; + return (int)$sizeString * 1073741824; default: - return $size_str; + return $sizeString; } } diff --git a/view.tag.php b/view.tag.php index b54f308c..6fd741bc 100644 --- a/view.tag.php +++ b/view.tag.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Action * @since 1.0 * @author trabis */ diff --git a/visit.php b/visit.php index d938793e..e754dbcf 100644 --- a/visit.php +++ b/visit.php @@ -14,8 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher - * @subpackage Action * @since 1.0 * @author trabis * @author The SmartFactory @@ -50,5 +48,5 @@ header('Location: ' . $fileObj->getFileUrl()); } -echo ''; +echo ''; exit(); diff --git a/xoops_version.php b/xoops_version.php index f3e592e3..f46f432a 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -14,7 +14,6 @@ /** * @copyright The XUUPS Project http://sourceforge.net/projects/xuups/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package Publisher * @since 1.0 * @author trabis * @author The SmartFactory @@ -24,8 +23,6 @@ use XoopsModules\Publisher; use XoopsModules\Publisher\Constants; - - require_once __DIR__ . '/preloads/autoloader.php'; $moduleDirName = basename(__DIR__); @@ -39,8 +36,8 @@ $modversion = [ 'version' => '1.08', - 'module_status' => 'Alpha 1', - 'release_date' => '2020/05/18', + 'module_status' => 'Alpha 2', + 'release_date' => '2020/07/08', 'name' => _MI_PUBLISHER_MD_NAME, 'description' => _MI_PUBLISHER_MD_DESC, 'author' => 'Trabis (www.Xuups.com)', @@ -65,7 +62,7 @@ 'onInstall' => 'include/oninstall.php', 'onUpdate' => 'include/onupdate.php', // ------------------- Min Requirements ------------------- - 'min_php' => '7.1', + 'min_php' => '7.2', 'min_xoops' => '2.5.10', 'min_admin' => '1.2', 'min_db' => ['mysql' => '5.5'], @@ -228,8 +225,8 @@ 'description' => _MI_PUBLISHER_LATEST_NEWS_DSC, 'show_func' => 'publisher_latest_news_show', 'edit_func' => 'publisher_latest_news_edit', - 'options' => '0|6|1|300|0|0|300|30|up|datesub|1|900|400|1|dcdcdc|CENTER|1|0|0|1|1|1|1|0|0|0|0|0|1|0|normal|0', - 'template' => 'publisher_latest_news.tpl', + 'options' => '0|6|1|300|0|0|300|30|up|datesub|1|900|400|1|dcdcdc|CENTER|1|0|0|1|1|1|1|0|0|0|0|0|1|0|normal|0', + 'template' => 'publisher_latest_news.tpl', ]; $modversion['blocks'][] = [ @@ -269,7 +266,9 @@ ['file' => 'publisher_addfile.tpl', 'description' => '_MI_PUBLISHER_ADDFILE_DSC'], ['file' => 'publisher_search.tpl', 'description' => '_MI_PUBLISHER_SEARCH_DSC'], ['file' => 'publisher_author_items.tpl', 'description' => '_MI_PUBLISHER_AUTHOR_ITEMS_DSC'], - ['file' => 'publisher_archive.tpl', 'description' => '_MI_PUBLISHER_ARCHIVE__DSC'], + ['file' => 'publisher_archive.tpl', 'description' => '_MI_PUBLISHER_ARCHIVE_DSC'], + //admin + ['file' => 'publisher_trello.tpl', 'description' => '_MI_PUBLISHER_TRELLO_DSC', 'type' => 'admin'], ]; // Config categories @@ -376,7 +375,7 @@ 'options' => array_merge( [_MI_PUBLISHER_URL_REWRITE_NONE => 'none'], [_MI_PUBLISHER_URL_REWRITE_PATHINFO => 'path-info'], // Is performing module install/update? - ($isModuleAction && in_array(PHP_SAPI, ['apache', 'apache2handler', 'cgi-fcgi', 'fpm-fcgi'])) ? [_MI_PUBLISHER_URL_REWRITE_HTACCESS => 'htaccess'] : [] + ($isModuleAction && in_array(PHP_SAPI, ['apache', 'apache2handler', 'cgi-fcgi', 'fpm-fcgi'], true)) ? [_MI_PUBLISHER_URL_REWRITE_HTACCESS => 'htaccess'] : [] ), 'category' => 'seo', ]; @@ -488,7 +487,6 @@ 'category' => 'indexcat', ]; - $modversion['config'][] = [ 'name' => 'cat_display_summary', 'title' => '_MI_PUBLISHER_DCS', @@ -519,7 +517,6 @@ 'category' => 'category', ]; - $modversion['config'][] = [ 'name' => 'idxcat_display_art_count', 'title' => '_MI_PUBLISHER_ARTCOUNT', @@ -530,7 +527,6 @@ 'category' => 'indexcat', ]; - $modversion['config'][] = [ 'name' => 'idxcat_show_rss_link', 'title' => '_MI_PUBLISHER_SHOW_RSS', @@ -604,8 +600,6 @@ 'category' => 'indexcat', ]; - - ################### LATEST PUBLISHED ARTICLES FOR INDEX AND CATEGORY PAGE #################### // group header @@ -645,8 +639,6 @@ 'category' => 'indexcattemplate', ]; - - $modversion['config'][] = [ 'name' => 'idxcat_display_date_col', 'title' => '_MI_PUBLISHER_DISDATECOL', @@ -806,7 +798,7 @@ 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, - 'category' => 'item', + 'category' => 'item', ]; $modversion['config'][] = [ @@ -849,7 +841,6 @@ 'category' => 'item', ]; - $modversion['config'][] = [ 'name' => 'item_disp_blocks_summary', 'title' => '_MI_PUBLISHER_DISP_BLOCK_SUM', @@ -870,7 +861,6 @@ 'category' => 'item', ]; - $modversion['config'][] = [ 'name' => 'maximum_filesize', 'title' => '_MI_PUBLISHER_MAX_SIZE', @@ -878,7 +868,7 @@ 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '10485760', //10MB - 'category' => 'item', + 'category' => 'item', ]; $modversion['config'][] = [ @@ -898,7 +888,7 @@ 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '8000', - 'category' => 'item', + 'category' => 'item', ]; $modversion['config'][] = [ @@ -908,7 +898,7 @@ 'formtype' => 'textbox', 'valuetype' => 'text', 'default' => '8000', - 'category' => 'item', + 'category' => 'item', ]; $modversion['config'][] = [ @@ -946,7 +936,6 @@ 'category' => 'item', ]; - ################### LATEST ARTICLES IN ARTICLE PAGE #################### // group header @@ -1211,7 +1200,6 @@ 'category' => 'group_header', ]; - $modversion['config'][] = [ 'name' => 'authorpage_display_image', 'title' => '_MI_PUBLISHER_MAINIMAGE', @@ -1350,7 +1338,7 @@ 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 1, - 'category' => 'format', + 'category' => 'format', ]; $modversion['config'][] = [ @@ -1636,8 +1624,6 @@ 'category' => 'permissions', ]; - - $modversion['config'][] = [ 'name' => 'perm_com_art_level', 'title' => '_MI_PUBLISHER_COMMENTS', @@ -1679,7 +1665,7 @@ 'description' => '_MI_PUBLISHER_SHOW_SAMPLE_BUTTON_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 0, + 'default' => 1, ]; /**