예제 #1
0
 function getAvailableLevelsBlock()
 {
     if (!$this->isLogged()) {
         return array(MsgBox(_t('_membership_err_required_login')));
     }
     if (!isProfileActive()) {
         return array(MsgBox(_t('_membership_err_not_active')));
     }
     $aMembership = $this->_oDb->getMembershipsBy(array('type' => 'price_all'));
     if (empty($aMembership)) {
         return array(MsgBox(_t('_membership_txt_empty')));
     }
     return $this->_oTemplate->displayAvailableLevels($aMembership);
 }
예제 #2
0
 function processMembershipChecksForMediaUploads(&$aInputs)
 {
     $isAdmin = $GLOBALS['logged']['admin'] && isProfileActive($this->_iProfileId);
     defineMembershipActions(array('photos add', 'sounds add', 'videos add', 'files add'));
     if (defined('BX_PHOTOS_ADD')) {
         $aCheck = checkAction(getLoggedId(), BX_PHOTOS_ADD);
     }
     if (!defined('BX_PHOTOS_ADD') || $aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$isAdmin) {
         unset($aInputs['thumb']);
     }
     $a = array('images' => 'PHOTOS', 'videos' => 'VIDEOS', 'sounds' => 'SOUNDS', 'files' => 'FILES');
     foreach ($a as $k => $v) {
         if (defined("BX_{$v}_ADD")) {
             $aCheck = checkAction(getLoggedId(), constant("BX_{$v}_ADD"));
         }
         if ((!defined("BX_{$v}_ADD") || $aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) && !$isAdmin) {
             unset($this->_aMedia[$k]);
             unset($aInputs['header_' . $k]);
             unset($aInputs[$k . '_choice']);
             unset($aInputs[$k . '_upload']);
         }
     }
 }
예제 #3
0
 function isAllowedReadForum(&$aDataEntry, $iProfileId = -1)
 {
     if (-1 == $iProfileId) {
         $iProfileId = $this->_iProfileId;
     }
     return $this->isAdmin() || $GLOBALS['logged']['member'] && $aDataEntry['author_id'] == $this->_iProfileId && isProfileActive($this->_iProfileId) || $this->_oPrivacyProduct->check('view_forum', $aDataEntry['id'], $iProfileId);
 }
예제 #4
0
 function isEntryAdmin($aDataEntry, $iProfileId = 0)
 {
     if (!$iProfileId) {
         $iProfileId = $this->_iProfileId;
     }
     if (($GLOBALS['logged']['member'] || $GLOBALS['logged']['admin']) && $aDataEntry['author_id'] == $iProfileId && isProfileActive($iProfileId)) {
         return true;
     }
     return $this->_oDb->isGroupAdmin($aDataEntry['id'], $iProfileId) && isProfileActive($iProfileId);
 }
예제 #5
0
 function isAllowedDelete(&$aSite, $isPerformAction = false)
 {
     if ($this->isAdmin() || $GLOBALS['logged']['member'] && $aSite['ownerid'] == $this->iOwnerId && isProfileActive($this->iOwnerId)) {
         return true;
     }
     $this->_defineActions();
     $aCheck = checkAction($this->iOwnerId, BX_SITES_DELETE_ANY_SITE, $isPerformAction);
     return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED;
 }
예제 #6
0
function isLoggedActive()
{
    return isProfileActive();
}
예제 #7
0
 function isAdmin()
 {
     return $GLOBALS['logged']['admin'] && isProfileActive($this->_iProfileId);
 }
예제 #8
0
 /**
  * Check whether the viewer can make requested action.
  *
  * @param string $sAction action name from 'sys_priacy_actions' table.
  * @param integer $iObjectId object ID the action to be performed with.
  * @param integer $iViewerId viewer ID.
  * @return boolean result of operation.
  */
 function check($sAction, $iObjectId, $iViewerId = 0)
 {
     if (empty($iViewerId)) {
         $iViewerId = getLoggedId();
     }
     if (isLogged() && !isProfileActive($iViewerId)) {
         return false;
     }
     $aObject = $this->_oDb->getObjectInfo($this->getFieldAction($sAction), $iObjectId);
     if (empty($aObject) || !is_array($aObject)) {
         return false;
     }
     if ($iViewerId == $aObject['owner_id']) {
         return true;
     }
     if ($this->_oDb->isGroupMember($aObject['group_id'], $aObject['owner_id'], $iViewerId)) {
         return true;
     }
     return $this->isDynamicGroupMember($aObject['group_id'], $aObject['owner_id'], $iViewerId, $iObjectId);
 }