Esempio n. 1
0
 public function serviceGetBlockFormInvite()
 {
     $iProfileId = $this->getProfileId();
     $iAccountId = $this->getAccountId($iProfileId);
     $mixedAllowed = $this->isAllowedInvite($iProfileId);
     if ($mixedAllowed !== true) {
         return array('content' => MsgBox($mixedAllowed));
     }
     $iInvited = (int) $this->_oDb->getInvites(array('type' => 'count_by_account', 'value' => $iAccountId));
     $iInvites = $this->_oConfig->getCountPerUser() - $iInvited;
     if ($iInvites <= 0) {
         return array('content' => MsgBox(_t('_bx_invites_err_limit_reached')));
     }
     $oForm = $this->getFormObjectInvite();
     $oForm->aInputs['text']['value'] = _t('_bx_invites_msg_invitation');
     $sResult = '';
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $sEmails = bx_process_input($oForm->getCleanValue('emails'));
         $sText = bx_process_pass($oForm->getCleanValue('text'));
         $mixedResult = $this->invite(BX_INV_TYPE_FROM_MEMBER, $sEmails, $sText, $iInvites, $oForm);
         if ($mixedResult !== false) {
             $sResult = _t('_bx_invites_msg_invitation_sent', (int) $mixedResult);
         } else {
             $sResult = _t('_bx_invites_err_not_available');
         }
         $sResult = MsgBox($sResult);
     }
     return array('content' => $sResult . $oForm->getCode());
 }
Esempio n. 2
0
 function formTester()
 {
     $sMsg = '';
     if (isset($_POST['tester_submit']) && $_POST['tester_submit']) {
         $isHTML = bx_get('html') == 'on' ? true : false;
         $sRecipient = bx_process_pass(bx_get('recipient'));
         $sSubj = bx_process_pass(bx_get('subject'));
         $sBody = bx_process_pass(bx_get('body'), $isHTML ? BX_DATA_HTML : BX_DATA_TEXT);
         if (sendMail($sRecipient, $sSubj, $sBody, 0, array(), BX_EMAIL_SYSTEM, $isHTML ? 'html' : '')) {
             $sMsg = MsgBox(_t('_bx_smtp_send_ok'));
         } else {
             $sMsg = MsgBox(_t('_bx_smtp_send_fail'));
         }
     }
     $aForm = array('form_attrs' => array('method' => 'post'), 'inputs' => array('recipient' => array('type' => 'text', 'name' => 'recipient', 'caption' => _t('_bx_smtp_recipient'), 'value' => ''), 'subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_bx_smtp_subject'), 'value' => ''), 'body' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_bx_smtp_body'), 'value' => ''), 'html' => array('type' => 'checkbox', 'name' => 'html', 'caption' => _t('_bx_smtp_is_html'), 'checked' => false), 'Submit' => array('type' => 'submit', 'name' => 'tester_submit', 'value' => _t("_Submit"))));
     $oForm = new BxTemplFormView($aForm);
     return $sMsg . $oForm->getCode();
 }
 protected function def($aData, $sKey, $a, &$sAutoMessage)
 {
     if (isset($aData[$sKey])) {
         return bx_process_pass($aData[$sKey]);
     }
     if (!empty($a['def_exp'])) {
         $s = $this->{$a['def_exp'][0]}($a['def_exp'][1]);
         if ($s) {
             $sAutoMessage = _t('_sys_inst_conf_found') . '<br />';
             return $s;
         } else {
             $sAutoMessage = _t('_sys_inst_conf_not_found') . '<br />';
         }
     }
     return isset($a['def']) ? $a['def'] : '';
 }