Skip to content

Commit

Permalink
Merge pull request #121 from mambax7/master
Browse files Browse the repository at this point in the history
1.07 Final
  • Loading branch information
mambax7 authored Jun 9, 2019
2 parents 88e3d53 + aa807e9 commit 301a930
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 33 deletions.
6 changes: 5 additions & 1 deletion class/CategoryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
34 changes: 15 additions & 19 deletions class/ItemHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion class/MimetypeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
11 changes: 6 additions & 5 deletions class/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'";
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<h5>1.07 Final [2019-06-08]</h5> Dev: XOOPS 2.5.10, PHP 7.3.6
<hr>
- Unnecessary closures (mamba)
- fix: delete $publisherIsAdmin check (mamba)


<h5>1.07 RC2 [2019-06-08]</h5> Dev: XOOPS 2.5.10, PHP 7.3.6
<hr>
- reverted in_array() true check (mamba)
Expand Down
6 changes: 0 additions & 6 deletions item.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@
/** @var Publisher\Helper $helper */
$helper = Publisher\Helper::getInstance();

$publisherIsAdmin = $helper->isUserAdmin();
if (false === $publisherIsAdmin) {
redirect_header('<script>javascript:history.go(-1)</script>', 1, _MD_PUBLISHER_NO_CAT_PERMISSIONS);
}


// Creating the item object for the selected item
$itemObj = $helper->getHandler('Item')->get($itemId);

Expand Down
2 changes: 1 addition & 1 deletion xoops_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 301a930

Please sign in to comment.