Skip to content

Commit

Permalink
Merge pull request #24 from mambax7/master
Browse files Browse the repository at this point in the history
1.03 Beta 2
  • Loading branch information
mambax7 committed Mar 20, 2016
2 parents 32938b0 + 53ea587 commit 4edd4f8
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 178 deletions.
13 changes: 4 additions & 9 deletions admin/admin_footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
* @author XOOPS Development Team
* @version $Id $
* @author XOOPS Development Team
* @version $Id $
*/

global $xoopsModule;
$pathIcon32 = XOOPS_URL .'/' . $xoopsModule->getInfo('sysIcons32');
$pathIcon32 = XOOPS_URL . '/' . $xoopsModule->getInfo('sysIcons32');

echo "<div class='adminfooter'>\n"
." <div style='text-align: center;'>\n"
." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
." </div>\n"
.' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
.'</div>';
echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>';

xoops_cp_footer();
34 changes: 19 additions & 15 deletions class/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct()

/**
* @param string $method
* @param array $args
* @param array $args
*
* @return mixed
*/
Expand Down Expand Up @@ -379,7 +379,9 @@ public function __construct(XoopsDatabase $db)
*
* @param int $id itemid of the user
*
* @return mixed reference to the {@link PublisherCategory} object, FALSE if failed
* @param null $fields
* @return mixed reference to the <a href='psi_element://PublisherCategory'>PublisherCategory</a> object, FALSE if failed
* object, FALSE if failed
*/
public function get($id = null, $fields = null)
{
Expand All @@ -396,9 +398,8 @@ public function get($id = null, $fields = null)
/**
* insert a new category in the database
*
* @param object $category reference to the {@link PublisherCategory} object
* @param bool $force
*
* @param object|XoopsObject $category reference to the {@link PublisherCategory}
* @param bool $force
* @return bool FALSE if failed, TRUE if already present and unchanged or successful
*/
public function insert(XoopsObject $category, $force = false) //insert(&$category, $force = false)
Expand Down Expand Up @@ -426,7 +427,7 @@ public function insert(XoopsObject $category, $force = false) //insert(&$categor
* delete a category from the database
*
* @param XoopsObject $category reference to the category to delete
* @param bool $force
* @param bool $force
*
* @return bool FALSE if failed.
*/
Expand Down Expand Up @@ -458,14 +459,15 @@ public function delete(XoopsObject $category, $force = false) //delete(&$categor
* 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 bool $idAsKey use the categoryid as key for the array?
*
* @return array array of {@link XoopsItem} objects
* @param bool $as_object
* @return array array of <a href='psi_element://XoopsItem'>XoopsItem</a> objects
*/
public function &getObjects(CriteriaElement $criteria = null, $idAsKey = false, $as_object = true) //&getObjects($criteria = null, $idAsKey = false)
{
$ret = array();
$theObjects = parent::getObjects($criteria, true);
$theObjects =& parent::getObjects($criteria, true);
foreach ($theObjects as $theObject) {
if (!$idAsKey) {
$ret[] = $theObject;
Expand All @@ -479,12 +481,12 @@ public function &getObjects(CriteriaElement $criteria = null, $idAsKey = false,
}

/**
* @param int $limit
* @param int $start
* @param int $parentid
* @param int $limit
* @param int $start
* @param int $parentid
* @param string $sort
* @param string $order
* @param bool $idAsKey
* @param bool $idAsKey
*
* @return array
*/
Expand Down Expand Up @@ -690,11 +692,13 @@ public function getSubCats($categories)
*
* @param CriteriaElement $criteria {@link CriteriaElement}
*
* @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)
{
$categories = $this->getObjects($criteria);
$categories =& $this->getObjects($criteria);
foreach ($categories as $category) {
if (!$this->delete($category)) {
return false;
Expand All @@ -715,7 +719,7 @@ public function publishedItemsCount($catId = 0)
}

/**
* @param int $catId
* @param int $catId
* @param string $status
*
* @return mixed
Expand Down
36 changes: 18 additions & 18 deletions class/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct($id = null)

/**
* @param string $method
* @param array $args
* @param array $args
*
* @return mixed
*/
Expand All @@ -78,8 +78,8 @@ public function __call($method, $args)

/**
* @param string $postField
* @param array $allowedMimetypes
* @param array $errors
* @param array $allowedMimetypes
* @param array $errors
*
* @return bool
*/
Expand Down Expand Up @@ -110,8 +110,8 @@ public function checkUpload($postField, $allowedMimetypes = array(), &$errors)

/**
* @param string $postField
* @param array $allowedMimetypes
* @param array $errors
* @param array $allowedMimetypes
* @param array $errors
*
* @return bool
*/
Expand Down Expand Up @@ -153,16 +153,16 @@ public function storeUpload($postField, $allowedMimetypes = array(), &$errors)

/**
* @param null|array $allowedMimetypes
* @param bool $force
* @param bool $doupload
* @param bool $force
* @param bool $doupload
*
* @return bool
*/
public function store($allowedMimetypes = null, $force = true, $doupload = true)
{
if ($this->isNew()) {
$errors = array();
$ret = true;
$ret = true;
if ($doupload) {
$ret = $this->storeUpload('item_upload_file', $allowedMimetypes, $errors);
}
Expand Down Expand Up @@ -302,12 +302,12 @@ public function __construct(XoopsDatabase $db)
/**
* delete a file from the database
*
* @param object $file reference to the file to delete
* @param bool $force
* @param XoopsObject $file reference to the file to delete
* @param bool $force
*
* @return bool FALSE if failed.
*/
public function delete(&$file, $force = false)
public function delete(XoopsObject $file, $force = false) //delete(&$file, $force = false)
{
$ret = false;
// Delete the actual file
Expand All @@ -330,7 +330,7 @@ public function deleteItemFiles(&$itemObj)
if (strtolower(get_class($itemObj)) !== 'publisheritem') {
return false;
}
$files =& $this->getAllFiles($itemObj->itemid());
$files = $this->getAllFiles($itemObj->itemid());
$result = true;
foreach ($files as $file) {
if (!$this->delete($file)) {
Expand All @@ -344,17 +344,17 @@ public function deleteItemFiles(&$itemObj)
/**
* retrieve all files
*
* @param int $itemid
* @param int $status
* @param int $limit
* @param int $start
* @param int $itemid
* @param int $status
* @param int $limit
* @param int $start
* @param string $sort
* @param string $order
* @param array $category
* @param array $category
*
* @return array array of {@link PublisherFile} objects
*/
public function &getAllFiles($itemid = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = array())
public function getAllFiles($itemid = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = array())
{
global $xoopsDB;
$files = array();
Expand Down
2 changes: 1 addition & 1 deletion class/form/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function createElements()

// EDITOR
$groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$gpermHandler =& $this->publisher->getHandler('groupperm');
$gpermHandler = $this->publisher->getHandler('groupperm');
$moduleId = $this->publisher->getModule()->mid();
$allowedEditors = publisherGetEditors($gpermHandler->getItemIds('editors', $groups, $moduleId));
$nohtml = false;
Expand Down
8 changes: 4 additions & 4 deletions class/form/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function createElements($obj)
// TAGS
if (xoops_isActiveModule('tag') && $this->isGranted(PublisherConstants::PUBLISHER_ITEM_TAG)) {
include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
$textTags = new XoopsFormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
$textTags = new TagFormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
$this->addElement($textTags);
}

Expand Down Expand Up @@ -285,9 +285,9 @@ public function createElements($obj)
// STATUS
if ($this->isGranted(PublisherConstants::PUBLISHER_STATUS)) {
$options = array(
PublisherConstants::PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED,
PublisherConstants::PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED,
PublisherConstants::PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE,
PublisherConstants::PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED,
PublisherConstants::PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
$statusSelect = new XoopsFormSelect(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
$statusSelect->addOptionArray($options);
Expand Down Expand Up @@ -515,8 +515,8 @@ public function createElements($obj)
$table .= '</tr>';

foreach ($filesObj as $fileObj) {
$modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>";
$delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>";
$modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>";
$delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>";
$not_visible = '';
if ($fileObj->status() == 0) {
$not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'/>";
Expand Down
12 changes: 7 additions & 5 deletions class/groupperm.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ class PublisherGroupPermHandler extends XoopsGroupPermHandler
/**
* Check permission
*
* @param string $gpermName Name of permission
* @param int $gpermItemId ID of an item
* @param int /array $gpermGroupId A group ID or an array of group IDs
* @param int $gpermModId ID of a module
* @param string $gpermName Name of permission
* @param int $gpermItemId ID of an item
* @param $gpermGroupId
* @param int $gpermModId ID of a module
*
* @param bool $trueifadmin
* @return bool TRUE if permission is enabled
* @internal param $int /array $gpermGroupId A group ID or an array of group IDs
*/
public function checkRight($gpermName, $gpermItemId, $gpermGroupId, $gpermModId = 1)
public function checkRight($gpermName, $gpermItemId, $gpermGroupId, $gpermModId = 1, $trueifadmin = true) //checkRight($gpermName, $gpermItemId, $gpermGroupId, $gpermModId = 1)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', $gpermModId));
$criteria->add(new Criteria('gperm_name', $gpermName));
Expand Down
Loading

0 comments on commit 4edd4f8

Please sign in to comment.