Пример #1
0
 function _actionAdministrationManage($isAdminEntries, $sKeyBtnDelete, $sKeyBtnActivate, $sUrl = false)
 {
     if (getPostFieldIfSet('action_activate') && (isset($_POST['entry']) && is_array($_POST['entry']))) {
         foreach ($_POST['entry'] as $iId) {
             if ($this->_oDb->activateEntry($iId)) {
                 $this->onEventChanged($iId, 'approved');
             }
         }
     } elseif (getPostFieldIfSet('action_delete') && (isset($_POST['entry']) && is_array($_POST['entry']))) {
         foreach ($_POST['entry'] as $iId) {
             $aDataEntry = $this->_oDb->getEntryById($iId);
             if (!$this->isAllowedDelete($aDataEntry)) {
                 continue;
             }
             if ($this->_oDb->deleteEntryByIdAndOwner($iId, 0, $this->isAdmin())) {
                 $this->onEventDeleted($iId);
             }
         }
     }
     if ($isAdminEntries) {
         $sContent = $this->_manageEntries('admin', '', true, 'bx_twig_admin_form', array('action_delete' => $sKeyBtnDelete), '', true, 0, $sUrl);
     } else {
         $sContent = $this->_manageEntries('pending', '', true, 'bx_twig_admin_form', array('action_activate' => $sKeyBtnActivate, 'action_delete' => $sKeyBtnDelete), '', true, 0, $sUrl);
     }
     return $sContent;
 }
Пример #2
0
function getEmailMessage($sAction)
{
    $sErrorC = _t('_Error Occured');
    $sApplyChangesC = _t('_Save');
    $sSubjectC = _t('_Subject');
    $sBodyC = _t('_adm_mmail_Body');
    $sTextBodyC = _t('_adm_mmail_Text_email_body');
    $sPreviewMessageC = _t('_Preview');
    $sDeleteC = _t('_Delete');
    $sMessageID = (int) getPostFieldIfSet('msgs_id');
    $sSubject = $sBody = "";
    if (isset($_POST['body']) && getPostFieldIfSet('action') != 'delete') {
        $sSubject = process_pass_data($_POST['subject']);
        $sBody = process_pass_data($_POST['body']);
    } elseif ($sMessageID) {
        list($sSubject, $sBody) = $GLOBALS['MySQL']->getRow("SELECT `subject`, `body` FROM `sys_sbs_messages` WHERE `id`= ? LIMIT 1", [$sMessageID], PDO::FETCH_NUM);
    }
    $sSubject = htmlspecialchars($sSubject);
    $aForm = array('form_attrs' => array('name' => 'sys_sbs_messages', 'action' => $GLOBALS['site']['url_admin'] . 'notifies.php', 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_sbs_messages', 'key' => 'ID', 'submit_name' => 'add_message')), 'inputs' => array('subject' => array('type' => 'text', 'name' => 'subject', 'value' => $sSubject, 'caption' => $sSubjectC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(2, 128), 'error' => $sErrorC), 'db' => array('pass' => 'Xss')), 'body' => array('type' => 'textarea', 'name' => 'body', 'value' => $sBody, 'caption' => $sBodyC, 'required' => true, 'html' => 2, 'html_no_link_conversion' => true, 'attrs' => array('style' => "height:400px;"), 'checker' => array('func' => 'length', 'params' => array(10, 32000), 'error' => $sErrorC), 'db' => array('pass' => 'XssHtml')), 'msgs_id' => array('type' => 'hidden', 'name' => 'msgs_id', 'value' => $sMessageID), 'control' => array('type' => 'input_set', array('type' => 'submit', 'name' => 'add_message', 'caption' => $sApplyChangesC, 'value' => $sApplyChangesC), array('type' => 'submit', 'name' => 'preview_message', 'caption' => $sPreviewMessageC, 'value' => $sPreviewMessageC))));
    if ($sMessageID) {
        $aForm['inputs']['control'][] = array('type' => 'submit', 'name' => 'delete_message', 'caption' => $sDeleteC, 'value' => $sDeleteC);
    }
    $sResult = '';
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        if ($sAction == 'add') {
            if ($sMessageID > 0) {
                $oForm->update($sMessageID);
            } else {
                $sMessageID = $oForm->insert();
            }
        }
        $sResult = $sMessageID > 0 ? MsgBox(_t('_Success'), 3) : MsgBox($sErrorC);
    }
    return DesignBoxContent(_t('_adm_mmail_Email_message'), $sResult . $oForm->getCode(), 11);
}