diff --git a/class/CategoryHandler.php b/class/CategoryHandler.php index bfd51778..e76e0c1b 100644 --- a/class/CategoryHandler.php +++ b/class/CategoryHandler.php @@ -50,7 +50,11 @@ class CategoryHandler extends \XoopsPersistableObjectHandler public function __construct(\XoopsDatabase $db = null, $helper = null) { /** @var \XoopsModules\Publisher\Helper $this->helper */ - $this->helper = $helper; + if (null === $helper) { + $this->helper = \XoopsModules\Publisher\Helper::getInstance(); + } else { + $this->helper = $helper; + } $publisherIsAdmin = $this->helper->isUserAdmin(); parent::__construct($db, 'publisher_categories', Category::class, 'categoryid', 'name'); } diff --git a/class/ItemHandler.php b/class/ItemHandler.php index d1304298..d185d0b9 100644 --- a/class/ItemHandler.php +++ b/class/ItemHandler.php @@ -51,7 +51,11 @@ class ItemHandler extends \XoopsPersistableObjectHandler public function __construct(\XoopsDatabase $db = null, $helper = null) { /** @var Publisher\Helper $this->helper */ - $this->helper = $helper; + if (null === $helper) { + $this->helper = \XoopsModules\Publisher\Helper::getInstance(); + } else { + $this->helper = $helper; + } $this->publisherIsAdmin = $this->helper->isUserAdmin(); parent::__construct($db, 'publisher_items', Item::class, 'itemid', 'title'); } @@ -326,14 +330,6 @@ public function getItemsCount($categoryid = -1, $status = '', $notNullFields = ' // $ret = array(); $criteria = $this->getItemsCriteria($categoryid, $status, $notNullFields, $criteriaPermissions); -// $publisherIsAdmin = $this->helper->isUserAdmin(); //mb -// if (!$this->publisherIsAdmin) { -// $criteriaDateSub = new \Criteria('datesub', time(), '<='); -// $criteria->add($criteriaDateSub); -// } - - - /* if (isset($categoryid) && $categoryid != -1) { $criteriaCategory = new \Criteria('categoryid', $categoryid); @@ -504,16 +500,16 @@ public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = } /** - * @param int $limit - * @param int $start - * @param array|string $status - * @param int $categoryid - * @param string $sort - * @param string $order - * @param string $notNullFields - * @param bool $asObject - * @param null $otherCriteria - * @param bool|string $idKey + * @param int $limit + * @param int $start + * @param array|string $status + * @param int $categoryid + * @param string $sort + * @param string $order + * @param string $notNullFields + * @param bool $asObject + * @param null\CriteriaCompo $otherCriteria + * @param bool|string $idKey * @return array * @internal param bool $asObject */ diff --git a/class/MimetypeHandler.php b/class/MimetypeHandler.php index 6865f793..e6cdc1d0 100644 --- a/class/MimetypeHandler.php +++ b/class/MimetypeHandler.php @@ -119,7 +119,7 @@ public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, /** * Format mime_types into array * - * @param null $mimeExt + * @param mixed|null $mimeExt * * @return array array of mime_types */ diff --git a/class/Utility.php b/class/Utility.php index e045e6fc..50e9198b 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -912,10 +912,11 @@ public static function addCategoryOption(Publisher\Category $categoryObj, $selec } /** - * @param int|array $selectedId - * @param int $parentcategory - * @param bool $allCatOption - * @param string $selectname + * @param int|array $selectedId + * @param int $parentcategory + * @param bool $allCatOption + * @param string $selectname + * @param bool $multiple * @return string */ public static function createCategorySelect($selectedId = 0, $parentcategory = 0, $allCatOption = true, $selectname = 'options[1]', $multiple = true) @@ -924,7 +925,7 @@ public static function createCategorySelect($selectedId = 0, $parentcategory = 0 $helper = Publisher\Helper::getInstance(); $selectedId = explode(',', $selectedId); - $selectedId = array_map(static function ($value) { return (int)$value; }, $selectedId); + $selectedId = array_map('intval', $selectedId); $selMultiple = ''; if ($multiple) { $selMultiple = " multiple='multiple'"; diff --git a/docs/changelog.txt b/docs/changelog.txt index c30586fd..3b84d1a2 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,9 @@ +
1.07 Final [2019-06-08]
Dev: XOOPS 2.5.10, PHP 7.3.6 +
+- Unnecessary closures (mamba) +- fix: delete $publisherIsAdmin check (mamba) + +
1.07 RC2 [2019-06-08]
Dev: XOOPS 2.5.10, PHP 7.3.6
- reverted in_array() true check (mamba) diff --git a/item.php b/item.php index 46a9cf54..c09667a5 100644 --- a/item.php +++ b/item.php @@ -34,12 +34,6 @@ /** @var Publisher\Helper $helper */ $helper = Publisher\Helper::getInstance(); -$publisherIsAdmin = $helper->isUserAdmin(); -if (false === $publisherIsAdmin) { - redirect_header('', 1, _MD_PUBLISHER_NO_CAT_PERMISSIONS); -} - - // Creating the item object for the selected item $itemObj = $helper->getHandler('Item')->get($itemId); diff --git a/xoops_version.php b/xoops_version.php index 041fb082..80602d94 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -36,7 +36,7 @@ $modversion = [ 'version' => '1.07', - 'module_status' => 'RC2', + 'module_status' => 'Final', 'release_date' => '2019/06/08', 'name' => _MI_PUBLISHER_MD_NAME, 'description' => _MI_PUBLISHER_MD_DESC,