function _actionJoin($iEntryId, $iProfileId, $sMsgAlreadyJoined, $sMsgAlreadyJoinedPending, $sMsgJoinSuccess, $sMsgJoinSuccessPending, $sMsgLeaveSuccess)
{
header('Content-type:text/html;charset=utf-8');
$iEntryId = (int) $iEntryId;
if (!($aDataEntry = $this->_oDb->getEntryByIdAndOwner($iEntryId, 0, true))) {
echo MsgBox(_t('_sys_request_page_not_found_cpt')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
exit;
}
if (!$this->isAllowedJoin($aDataEntry) || 0 !== strcasecmp($_SERVER['REQUEST_METHOD'], 'POST')) {
echo MsgBox(_t('_Access denied')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
exit;
}
$isFan = $this->_oDb->isFan($iEntryId, $this->_iProfileId, true) || $this->_oDb->isFan($iEntryId, $this->_iProfileId, false);
if ($isFan) {
if ($this->_oDb->leaveEntry($iEntryId, $this->_iProfileId)) {
$sRedirect = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
echo MsgBox($sMsgLeaveSuccess) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
exit;
}
} else {
$isConfirmed = $this->isEntryAdmin($aDataEntry) || !$aDataEntry[$this->_oDb->_sFieldJoinConfirmation] ? true : false;
if ($this->_oDb->joinEntry($iEntryId, $this->_iProfileId, $isConfirmed)) {
if ($isConfirmed) {
$this->onEventJoin($iEntryId, $this->_iProfileId, $aDataEntry);
$sRedirect = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry[$this->_oDb->_sFieldUri];
} else {
$this->onEventJoinRequest($iEntryId, $this->_iProfileId, $aDataEntry);
$sRedirect = '';
}
echo MsgBox($isConfirmed ? $sMsgJoinSuccess : $sMsgJoinSuccessPending) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div', $sRedirect);
exit;
}
}
echo MsgBox(_t('_Error Occured')) . genAjaxyPopupJS($iEntryId, 'ajaxy_popup_result_div');
exit;
}