/** * Checks if user is author of page * @param bit $action what the caller wants to do * * returns true of access is allowed */ function isMyItem($action) { global $_zp_current_admin_obj; if (parent::isMyItem($action)) { return true; } if (zp_loggedin($action)) { if (GALLERY_SECURITY == 'public' && $this->getShow() && $action == LIST_RIGHTS) { return LIST_RIGHTS; } if ($_zp_current_admin_obj->getUser() == $this->getAuthor()) { return true; } $subRights = $this->subRights(); if ($subRights) { $rights = LIST_RIGHTS; if ($subRights & MANAGED_OBJECT_RIGHTS_EDIT) { $rights = $rights | ZENPAGE_PAGES_RIGHTS; } if ($action & $rights) { return true; } } } return false; }
/** * Checks if user is news author * @param bit $action what the caller wants to do * * returns true of access is allowed */ function isMyItem($action) { global $_zp_current_admin_obj; if (parent::isMyItem($action)) { return true; } if (zp_loggedin($action)) { if (GALLERY_SECURITY == 'public' && $this->getShow() && $action == LIST_RIGHTS) { return true; } if ($_zp_current_admin_obj->getUser() == $this->getAuthor()) { return true; // he is the author } $myObjects = $_zp_current_admin_obj->getObjects('news', true); if (!empty($myObjects)) { $thisCats = $this->getCategories(); if (empty($thisCats) && isset($myObjects['`'])) { // un-categorized $subRights = $myObjects['`']['edit']; if ($subRights) { $rights = LIST_RIGHTS; if ($subRights & MANAGED_OBJECT_RIGHTS_EDIT) { $rights = $rights | ZENPAGE_NEWS_RIGHTS; } if ($action & $rights) { return true; } } } else { foreach ($thisCats as $category) { $cat = newCategory($category['titlelink']); if ($cat->isMyItem($action)) { return true; } } } } } return false; }