Пример #1
0
 function getPostForm($iUnitID = 0)
 {
     $sAddNewC = _t('_bx_quotes_add_new');
     $sAction = 'add';
     $sQText = $sQText = '';
     if ($iUnitID) {
         $aQinfo = $this->_oDb->getQuote($iUnitID);
         $sQText = $aQinfo['Text'];
         $sQAuthor = $aQinfo['Author'];
         $sAction = 'edit';
     }
     $aForm = array('form_attrs' => array('name' => 'create_quotes_form', 'action' => BX_DOL_URL_ROOT . 'modules/?r=quotes/administration/', 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_quotes_units', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'Text' => array('type' => 'textarea', 'name' => 'Text', 'caption' => _t('_bx_quotes_text'), 'required' => true, 'value' => $sQText, 'checker' => array('func' => 'length', 'params' => array(3, 1024), 'error' => _t('_bx_quotes_text_err', 1024)), 'db' => array('pass' => 'Xss')), 'Author' => array('type' => 'text', 'name' => 'Author', 'caption' => _t('_bx_quotes_author'), 'required' => true, 'value' => $sQAuthor, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_quotes_author_err', 128)), 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => _t('_Submit'))));
     if ($iUnitID) {
         $aForm['inputs']['hidden_unitid'] = array('type' => 'hidden', 'name' => 'ID', 'value' => $iUnitID);
     }
     $sCode = '';
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $sCode = MsgBox(_t('_bx_quotes_fail'), 1);
         $aValsAdd = array();
         $iLastId = -1;
         if ($iUnitID > 0) {
             $oForm->update($iUnitID, $aValsAdd);
             $iLastId = $iUnitID;
             $sCode = MsgBox(_t('_bx_quotes_edited_success'), 1);
         } else {
             $iLastId = $oForm->insert($aValsAdd);
             $sCode = MsgBox(_t('_bx_quotes_success'), 1);
         }
     }
     return DesignBoxAdmin($sAddNewC, $sCode . $oForm->getCode(), '', '', 11);
 }
Пример #2
0
 function getFormCode()
 {
     $oForm = new BxTemplFormView($this->aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aValsAdd = array('Date' => time(), 'Uri' => $oForm->generateUri(), 'Status' => 'active', 'Owner' => $this->iOwnerId);
         if ($this->iAlbumId > 0 && $this->aInfo['Owner'] == $this->iOwnerId) {
             $aValsAdd = array('Date' => time());
             if (!$oForm->update($this->iAlbumId, $aValsAdd)) {
                 return MsgBox(_t('_sys_album_save_error'));
             } else {
                 return MsgBox(_t('_sys_album_save_succ'));
             }
         } else {
             $iAlbumId = $oForm->insert($aValsAdd);
             if (!$iAlbumId) {
                 return MsgBox(_t('_sys_album_save_error'));
             } else {
                 return MsgBox(_t('_sys_album_save_succ'));
             }
         }
     } else {
         return $oForm->getCode();
     }
 }
Пример #3
0
function PageCompPageMainCodeWithForm()
{
    global $oTemplConfig, $site;
    $aForm = array('form_attrs' => array('id' => 'post_us_form', 'action' => BX_DOL_URL_ROOT . 'contact.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_Your name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('_Name is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'message_subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_message_subject'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(5, 300), 'error' => _t('_ps_ferr_incorrect_length'))), 'message_text' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_Message text'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 5000), 'error' => _t('_ps_ferr_incorrect_length'))), 'captcha' => array('type' => 'captcha', 'caption' => _t('_Enter what you see'), 'name' => 'securityImageValue', 'required' => true, 'checker' => array('func' => 'captcha', 'error' => _t('_Incorrect Captcha'))), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'))));
    $oForm = new BxTemplFormView($aForm);
    $sForm = $oForm->getCode();
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        $sSenderName = process_pass_data($_POST['name'], BX_TAGS_STRIP);
        $sSenderEmail = process_pass_data($_POST['email'], BX_TAGS_STRIP);
        $sLetterSubject = process_pass_data($_POST['subject'], BX_TAGS_STRIP);
        $sLetterBody = process_pass_data($_POST['body'], BX_TAGS_STRIP);
        $sLetterBody = $sLetterBody . "\r\n" . '============' . "\r\n" . _t('_from') . ' ' . $sSenderName . "\r\n" . 'with email ' . $sSenderEmail;
        if (sendMail($site['email'], $sLetterSubject, $sLetterBody)) {
            $sActionKey = '_ADM_PROFILE_SEND_MSG';
        } else {
            $sActionKey = '_Email sent failed';
        }
        $sActionText = MsgBox(_t($sActionKey));
        $sForm = $sActionText . $sForm;
    } else {
        $sForm = $oForm->getCode();
    }
    return DesignBoxContent(_t('_CONTACT_H1'), $sForm, $oTemplConfig->PageCompThird_db_num);
}
Пример #4
0
function _getList($mixedResult, $bActive = false)
{
    $aForm = array('form_attrs' => array('id' => 'adm-email-templates', 'action' => $GLOBALS['site']['url_admin'] . 'email_templates.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_email_templates', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-emial-templates-save')), 'inputs' => array());
    $aLanguages = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Title` AS `title` FROM `sys_localization_languages`");
    $aLanguageChooser = array(array('key' => 0, 'value' => 'default'));
    foreach ($aLanguages as $aLanguage) {
        $aLanguageChooser[] = array('key' => $aLanguage['id'], 'value' => $aLanguage['title']);
    }
    $sLanguageCpt = _t('_adm_txt_email_language');
    $sSubjectCpt = _t('_adm_txt_email_subject');
    $sBodyCpt = _t('_adm_txt_email_body');
    $aEmails = $GLOBALS['MySQL']->getAll("SELECT `ID` AS `id`, `Name` AS `name`, `Subject` AS `subject`, `Body` AS `body`, `Desc` AS `description` FROM `sys_email_templates` WHERE `LangID`='0' ORDER BY `ID`");
    foreach ($aEmails as $aEmail) {
        $aForm['inputs'] = array_merge($aForm['inputs'], array($aEmail['name'] . '_Beg' => array('type' => 'block_header', 'caption' => $aEmail['description'], 'collapsable' => true, 'collapsed' => true), $aEmail['name'] . '_Language' => array('type' => 'select', 'name' => $aEmail['name'] . '_Language', 'caption' => $sLanguageCpt, 'value' => 0, 'values' => $aLanguageChooser, 'db' => array('pass' => 'Int'), 'attrs' => array('onchange' => "javascript:getTranslations(this)")), $aEmail['name'] . '_Subject' => array('type' => 'text', 'name' => $aEmail['name'] . '_Subject', 'caption' => $sSubjectCpt, 'value' => $aEmail['subject'], 'db' => array('pass' => 'Xss')), $aEmail['name'] . '_Body' => array('type' => 'textarea', 'name' => $aEmail['name'] . '_Body', 'caption' => $sBodyCpt, 'value' => $aEmail['body'], 'db' => array('pass' => 'XssHtml')), $aEmail['name'] . '_End' => array('type' => 'block_end')));
    }
    $aForm['inputs']['adm-emial-templates-save'] = array('type' => 'submit', 'name' => 'adm-emial-templates-save', 'value' => _t('_adm_btn_email_save'));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    $sResult = "";
    if ($oForm->isSubmittedAndValid()) {
        $iResult = 0;
        foreach ($aEmails as $aEmail) {
            $iEmailId = (int) $GLOBALS['MySQL']->getOne("SELECT `ID` FROM `sys_email_templates` WHERE `Name`='" . process_db_input($aEmail['name']) . "' AND `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "' LIMIT 1");
            if ($iEmailId != 0) {
                $iResult += (int) $GLOBALS['MySQL']->query("UPDATE `sys_email_templates` SET `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "' WHERE `ID`='" . $iEmailId . "'");
            } else {
                $iResult += (int) $GLOBALS['MySQL']->query("INSERT INTO `sys_email_templates` SET `Name`='" . process_db_input($aEmail['name']) . "', `Subject`='" . process_db_input($_POST[$aEmail['name'] . '_Subject']) . "', `Body`='" . process_db_input($_POST[$aEmail['name'] . '_Body']) . "', `LangID`='" . (int) $_POST[$aEmail['name'] . '_Language'] . "'");
            }
        }
        $bActive = true;
        $sResult .= MsgBox(_t($iResult > 0 ? "_adm_txt_email_success_save" : "_adm_txt_email_nothing_changed"), 3);
    }
    $sResult .= $oForm->getCode();
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('email_templates_list.html', array('display' => $bActive ? 'block' : 'none', 'content' => stripslashes($sResult), 'loading' => LoadingBox('adm-email-loading')));
}
Пример #5
0
 function getManagingForm()
 {
     $sApplyChangesC = _t('_sys_admin_apply');
     $sFromC = _t('_From');
     $sToC = _t('_To');
     $sSampleC = _t('_adm_ipbl_sample');
     $sTypeC = _t('_adm_ipbl_IP_Role');
     $sDescriptionC = _t('_Description');
     $sDatatimeC = _t('_adm_ipbl_Date_of_finish');
     $sErrorC = _t('_Error Occured');
     $aForm = array('form_attrs' => array('name' => 'apply_ip_list_form', 'action' => $this->_sActionUrl, 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_ip_list', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('FromIP' => array('type' => 'text', 'name' => 'from', 'caption' => $sFromC, 'info' => $sSampleC . ': 10.0.0.0', 'required' => true, 'checker' => array('func' => 'length', 'params' => array(7, 15), 'error' => $sErrorC)), 'ToIP' => array('type' => 'text', 'name' => 'to', 'caption' => $sToC, 'info' => $sSampleC . ': 10.0.0.100', 'required' => true, 'checker' => array('func' => 'length', 'params' => array(7, 15), 'error' => $sErrorC)), 'IPRole' => array('type' => 'select', 'name' => 'type', 'caption' => $sTypeC, 'values' => array('allow', 'deny'), 'required' => true), 'DateTime' => array('type' => 'datetime', 'name' => 'LastDT', 'caption' => $sDatatimeC, 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'db' => array('pass' => 'DateTime')), 'Desc' => array('type' => 'text', 'name' => 'desc', 'caption' => $sDescriptionC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(2, 128), 'error' => $sErrorC), 'db' => array('pass' => 'Xss')), 'ID' => array('type' => 'hidden', 'value' => '0', 'name' => 'id'), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sApplyChangesC)));
     $sResult = '';
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         /*list($iDay, $iMonth, $iYear) = explode( '/', $_REQUEST['datatime']);
           $iDay = (int)$iDay;
           $iMonth = (int)$iMonth;
           $iYear = (int)$iYear;
           //$sCurTime = date("Y:m:d H:i:s");// 2012-06-20 15:46:21
           $sCurTime = "{$iYear}:{$iMonth}:{$iDay} 12:00:00";*/
         $sFrom = sprintf("%u", ip2long($_REQUEST['from']));
         $sTo = sprintf("%u", ip2long($_REQUEST['to']));
         $sType = (int) $_REQUEST['type'] == 1 ? 'deny' : 'allow';
         $aValsAdd = array('From' => $sFrom, 'To' => $sTo, 'Type' => $sType);
         $iLastId = (int) $_REQUEST['id'] > 0 ? (int) $_REQUEST['id'] : -1;
         if ($iLastId > 0) {
             $oForm->update($iLastId, $aValsAdd);
         } else {
             $iLastId = $oForm->insert($aValsAdd);
         }
         $sResult = $iLastId > 0 ? MsgBox(_t('_Success'), 3) : MsgBox($sErrorC);
     }
     return $sResult . $oForm->getCode();
 }
Пример #6
0
function _getDefaults($mixedResult, $bActive = false)
{
    $sNamePrefix = 'adm-pvc-action-';
    $aForm = array('form_attrs' => array('id' => 'adm-pvc-defaults', 'action' => $GLOBALS['site']['url_admin'] . 'privacy.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_privacy_actions', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-pvc-defaults-save')), 'inputs' => array());
    $aValues = array();
    $aGroupIds = $GLOBALS['MySQL']->getColumn("SELECT `id` FROM `sys_privacy_groups` WHERE `owner_id`='0' AND `id` NOT IN('" . implode("','", array(BX_DOL_PG_DEFAULT, BX_DOL_PG_HIDDEN)) . "')");
    foreach ($aGroupIds as $iGroupId) {
        if (getParam('sys_ps_enabled_group_' . $iGroupId) == 'on') {
            $aValues[$iGroupId] = _t('_ps_group_' . $iGroupId . '_title');
        }
    }
    $sModule = '';
    $aActions = $GLOBALS['MySQL']->getAll("SELECT `id` AS `id`, `module_uri` AS `module`, `title` AS `title`, `default_group` AS `default_group` FROM `sys_privacy_actions` WHERE 1 ORDER BY `module_uri` ASC");
    foreach ($aActions as $aAction) {
        $sName = $sNamePrefix . $aAction['id'];
        $sValue = $aAction['default_group'];
        if ($aAction['module'] != $sModule) {
            if (!empty($sModule)) {
                $aForm['inputs'][$sModule . '_end'] = array('type' => 'block_end');
            }
            $sModule = $aAction['module'];
            $aForm['inputs'][$sModule . '_beg'] = array('type' => 'block_header', 'caption' => _t('_sys_module_' . $sModule), 'collapsable' => true, 'collapsed' => true);
        }
        if (!in_array($sValue, $aGroupIds)) {
            continue;
        }
        $aForm['inputs'][$sName] = array('type' => 'select', 'name' => $sName, 'caption' => _t($aAction['title']), 'value' => (int) $sValue, 'values' => $aValues, 'db' => array('pass' => 'Int'));
    }
    $aForm['inputs'][$sModule . '_end'] = array('type' => 'block_end');
    $aForm['inputs']['adm-pvc-defaults-save'] = array('type' => 'submit', 'name' => 'adm-pvc-defaults-save', 'value' => _t('_adm_btn_pvc_save'));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    $sResult = "";
    if ($oForm->isSubmittedAndValid()) {
        $iResult = 0;
        foreach ($aActions as $aAction) {
            $sName = $sNamePrefix . $aAction['id'];
            $sValueOld = $aAction['default_group'];
            if (!in_array($sValueOld, $aGroupIds)) {
                continue;
            }
            $sValueNew = bx_get($sName);
            if ($sValueNew === false || (int) $sValueNew == (int) $sValueOld) {
                continue;
            }
            $iResult += (int) $GLOBALS['MySQL']->query("UPDATE `sys_privacy_actions` SET `default_group`='" . (int) $sValueNew . "' WHERE `id`='" . $aAction['id'] . "'");
        }
        $bActive = true;
        $sResult .= MsgBox(_t($iResult > 0 ? "_adm_txt_pvc_success_save" : "_adm_txt_pvc_nothing_changed"), 3);
    }
    $sResult .= $oForm->getCode();
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('privacy_defaults.html', array('display' => $bActive ? 'block' : 'none', 'form' => stripslashes($sResult)));
}
Пример #7
0
/**
 * page code function
 */
function PageCompMainCode()
{
    ob_start();
    $aForm = array('form_attrs' => array('id' => 'sample_form', 'action' => BX_DOL_URL_ROOT . 'samples/forms.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('header_contact' => array('type' => 'block_header', 'caption' => 'Contact details'), 'name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_Your name'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('_Name is required'))), 'date' => array('type' => 'datepicker', 'name' => 'date', 'caption' => _t('Date'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Date is required'))), 'datetime' => array('type' => 'datetime', 'name' => 'datetime', 'caption' => _t('Datetime'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Datetime is required'))), 'email' => array('type' => 'text', 'name' => 'email', 'caption' => _t('_Your email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), 'header_message' => array('type' => 'block_header', 'caption' => 'Message details', 'collapsable' => true, 'collapsed' => false), 'message_subject' => array('type' => 'text', 'name' => 'subject', 'caption' => _t('_message_subject'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(5, 300), 'error' => _t('_ps_ferr_incorrect_length'))), 'message_text' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_Message text'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 5000), 'error' => _t('_ps_ferr_incorrect_length'))), 'header_advanced' => array('type' => 'block_header', 'caption' => 'Advanced details', 'collapsable' => true, 'collapsed' => true), 'select_something' => array('type' => 'select', 'name' => 'select_something', 'caption' => _t('Select something'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'select_radio' => array('type' => 'radio_set', 'name' => 'select_radio', 'caption' => _t('Select radio something'), 'values' => array(1 => 'One', 'Two', 'Three'), 'required' => true), 'choose_something' => array('type' => 'checkbox_set', 'name' => 'choose_something', 'caption' => _t('Choose something'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'select_multiple' => array('type' => 'select_multiple', 'name' => 'select_multiple', 'caption' => _t('Multiple select'), 'values' => array(1 => 'One', 'Two', 'Three', 'Four', 'Five'), 'required' => true), 'doublerange' => array('type' => 'doublerange', 'name' => 'doublerange', 'caption' => _t('Double Range'), 'attrs' => array('min' => 10, 'max' => 200), 'value' => '20-30', 'required' => true), 'header_submit' => array('type' => 'block_header', 'caption' => ''), 'iagree' => array('type' => 'checkbox', 'name' => 'iagree', 'value' => '1', 'caption' => _t('Do you like it?'), 'required' => true, 'checker' => array('func' => 'avail', 'error' => _t('Form can not be submitted if you don\'t like it.'))), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('_Reset'), 'attrs' => array('class' => 'bx-def-margin-sec-left')))));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        echo MsgBox('Data was successfully submitted');
    }
    echo $oForm->getCode();
    $s = ob_get_clean();
    return DesignBoxContent("Sample form", $s, BX_DB_PADDING_DEF);
}
Пример #8
0
function PageCodeEdit()
{
    $aForm = array('form_attrs' => array('id' => 'adm-css-edit', 'name' => 'adm-css-edit', 'action' => $GLOBALS['site']['url_admin'] . 'css_file.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'adm-css-save')), 'inputs' => array('css_file' => array('type' => 'select', 'name' => 'css_file', 'caption' => _t('_adm_txt_css_file'), 'value' => '', 'values' => array(), 'attrs' => array('onchange' => "javascript:document.forms['adm-css-edit'].submit();")), 'content' => array('type' => 'textarea', 'name' => 'content', 'caption' => _t('_adm_txt_css_content', $sFileName), 'value' => '', 'db' => array('pass' => 'XssHtml')), 'adm-css-save' => array('type' => 'submit', 'name' => 'adm-css-save', 'value' => _t('_adm_btn_css_save'))));
    //--- Get CSS files ---//
    $aItems = array();
    $sBasePath = BX_DIRECTORY_PATH_ROOT . "templates/tmpl_" . $GLOBALS['oSysTemplate']->getCode() . "/css/";
    $rHandle = opendir($sBasePath);
    while (($sFile = readdir($rHandle)) !== false) {
        if (is_file($sBasePath . $sFile) && substr($sFile, -3) == 'css') {
            $aItems[] = array('key' => $sFile, 'value' => $sFile);
        }
    }
    closedir($rHandle);
    $sCurrentFile = isset($_POST['css_file']) && preg_match("/^\\w+\\.css\$/", $_POST['css_file']) ? $_POST['css_file'] : $aItems[0]['key'];
    $aForm['inputs']['css_file']['value'] = $sCurrentFile;
    $aForm['inputs']['css_file']['values'] = $aItems;
    //--- Get CSS file's content ---//
    $sContent = '';
    $sAbsolutePath = $sBasePath . $sCurrentFile;
    if (strlen($sCurrentFile) > 0 && is_file($sAbsolutePath)) {
        $rHandle = fopen($sAbsolutePath, 'r');
        while (!feof($rHandle)) {
            $sContent .= fgets($rHandle, 4096);
        }
        fclose($rHandle);
    }
    //$aForm['inputs']['content']['value'] = isset($_POST['content']) ? $_POST['content'] : $sContent;
    $aForm['inputs']['content']['value'] = $sContent;
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        if (file_exists($sAbsolutePath) && isRWAccessible($sAbsolutePath)) {
            $rHandle = fopen($sAbsolutePath, 'w');
            if ($rHandle) {
                fwrite($rHandle, clear_xss($_POST['content']));
                fclose($rHandle);
                $mixedResult = '_adm_txt_css_success_save';
            } else {
                $mixedResult = '_adm_txt_css_failed_save';
            }
        } else {
            $mixedResult = '_adm_txt_css_cannot_write';
        }
    }
    $sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode()));
    if ($mixedResult !== true && !empty($mixedResult)) {
        $sResult = MsgBox(_t($mixedResult, $sCurrentFile), 3) . $sResult;
    }
    return $sResult;
}
Пример #9
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    $aForm = array('form_attrs' => array('id' => 'test_email_templates', 'action' => BX_DOL_URL_ROOT . '_ml.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array('l_new' => array('type' => 'textarea', 'name' => 'l_new', 'caption' => 'New Language'), 'l_old' => array('type' => 'textarea', 'name' => 'l_old', 'caption' => 'Old Language'), 'module_lang_file' => array('type' => 'checkbox', 'name' => 'module_lang_file', 'caption' => 'Module language file', 'value' => 1, 'checked' => true), 'submit' => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'))));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        $isModuleLangFile = $_POST['module_lang_file'] ? true : false;
        $aLang71 = getLangArray(process_pass_data($_POST['l_new']), $isModuleLangFile);
        $aLang70 = getLangArray(process_pass_data($_POST['l_old']), $isModuleLangFile);
        if (is_array($aLang71) && is_array($aLang70)) {
            $s .= prepareTextarea('Added Keys', findAddedKeys($aLang71, $aLang70));
            $s .= prepareTextarea('Changed Keys', findChangedKeys($aLang71, $aLang70));
            $aDeletedKeys = findDeletedKeys($aLang71, $aLang70);
            $s .= prepareTextarea('Deleted Keys', $aDeletedKeys);
            $s .= prepareTextareaWithDeltedKeys($aDeletedKeys);
        } else {
            $s = MsgBox("Invalid arrays") . $oForm->getCode();
        }
    } else {
        $s = $oForm->getCode();
    }
    return DesignBoxContent($GLOBALS['_page']['header'], $s, 11);
}
Пример #10
0
 function getAddSubcatForm($iSubCategoryID = 0, $bOnlyForm = false)
 {
     //admin side only
     $sSubmitC = _t('_bx_ads_add_subcategory');
     $sAction = 'add_sub_category';
     $aParentCategories = array();
     $vParentValues = $this->_oDb->getAllCatsInfo();
     while ($aCategInfo = mysql_fetch_assoc($vParentValues)) {
         $iID = $aCategInfo['ID'];
         $sName = $aCategInfo['Name'];
         $aParentCategories[$iID] = $sName;
     }
     $sTitle = $sDescription = '';
     $iParentID = 0;
     if ($iSubCategoryID) {
         $aSubcatInfos = $this->_oDb->getSubcatInfo($iSubCategoryID);
         $sTitle = $aSubcatInfos[0]['NameSub'];
         $sDescription = $aSubcatInfos[0]['Description'];
         $iParentID = (int) $aSubcatInfos[0]['IDClassified'];
     }
     //adding form
     $aForm = array('form_attrs' => array('name' => 'create_sub_cats_form', 'action' => 'javascript: void(0)', 'method' => 'post'), 'params' => array('db' => array('table' => $this->_oConfig->sSQLSubcatTable, 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'IDClassified' => array('type' => 'select', 'name' => 'IDClassified', 'caption' => _t('_bx_ads_parent_category'), 'values' => $aParentCategories, 'value' => $iParentID, 'db' => array('pass' => 'Int')), 'NameSub' => array('type' => 'text', 'name' => 'NameSub', 'caption' => _t('_Title'), 'required' => true, 'value' => $sTitle, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_ads_title_error_desc', 128)), 'db' => array('pass' => 'Xss')), 'Description' => array('type' => 'text', 'name' => 'Description', 'caption' => _t('_Description'), 'value' => $sDescription, 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sSubmitC, 'attrs' => array('onClick' => "AdmCreateSubcategory('{$this->sHomeUrl}{$this->sCurrBrowsedFile}'); return false;"))));
     if ($iSubCategoryID) {
         $aForm['inputs']['hidden_postid'] = array('type' => 'hidden', 'name' => 'id', 'value' => $iSubCategoryID);
     }
     $sCode = '';
     $sJS = $this->_oTemplate->addJs('main.js', true);
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aValsAdd = array();
         if ($iSubCategoryID == 0) {
             $sCategUri = uriGenerate(bx_get('NameSub'), $this->_oConfig->sSQLSubcatTable, 'SEntryUri');
             $aValsAdd['SEntryUri'] = $sCategUri;
         }
         $iLastId = -1;
         if ($iSubCategoryID > 0) {
             $oForm->update($iSubCategoryID, $aValsAdd);
             $iLastId = $iSubCategoryID;
         } else {
             $iLastId = $oForm->insert($aValsAdd);
         }
         if ($iLastId > 0) {
             $sCode = MsgBox(_t('_bx_ads_Sub_category_successfully_added'), 3);
         } else {
             $sCode = MsgBox(_t('_bx_ads_Sub_category_failed_add'), 3);
         }
     }
     if ($bOnlyForm) {
         return $sCode . $oForm->getCode();
     }
     $sResult = $sJS . $sCode . $oForm->getCode();
     if (bx_get('mode') == 'json') {
         require_once BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php';
         $oJson = new Services_JSON();
         return $oJson->encode($sResult);
         exit;
     }
     $sResult = $this->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sResult));
     return $GLOBALS['oFunctions']->popupBox('ads_add_sub_category', _t('_bx_ads_add_subcategory'), $sResult);
 }
Пример #11
0
 function getBlockCode_CreateGroup()
 {
     $sContent = "";
     $aValues = array_merge(array('0' => _t('_ps_cpt_none')), $this->_getSelectItems(array('type' => 'extendable', 'owner_id' => $this->_iOwnerId)));
     $aForm = array('form_attrs' => array('id' => 'ps-create-group-form', 'name' => 'ps-create-group-form', 'action' => BX_DOL_URL_ROOT . 'member_privacy.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_privacy_groups', 'key' => 'id', 'submit_name' => 'create')), 'inputs' => array('owner_id' => array('type' => 'hidden', 'name' => 'owner_id', 'value' => $this->_iOwnerId, 'db' => array('pass' => 'Int')), 'title' => array('type' => 'text', 'name' => 'title', 'caption' => _t("_ps_fcpt_title"), 'value' => '', 'checker' => array('func' => 'length', 'params' => array(3, 64), 'error' => _t('_ps_ferr_incorrect_length')), 'db' => array('pass' => 'Xss')), 'parent_id' => array('type' => 'select', 'name' => 'parent_id', 'caption' => _t("_ps_fcpt_extends"), 'value' => '', 'values' => $aValues, 'checker' => array('func' => 'length', 'params' => array(1, 4), 'error' => _t('_ps_ferr_incorrect_select')), 'db' => array('pass' => 'Int')), 'create' => array('type' => 'submit', 'name' => 'create', 'value' => _t("_ps_btncpt_create"))));
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iId = $oForm->insert();
         header('Location: ' . $oForm->aFormAttrs['action']);
         exit;
     } else {
         $sContent = $oForm->getCode();
     }
     $sContent = $this->parseHtmlByName('ps_create_group.html', array('form' => !empty($sContent) ? $sContent : MsgBox(_t('_Empty'))));
     return DesignBoxContent(_t("_ps_bcpt_create_group"), $sContent, 1);
 }
Пример #12
0
 function getBlockCode_Privacy()
 {
     $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id');
     $this->aFormPrivacy['inputs']['allow_view_to'] = $oPrivacy->getGroupChooser(getLoggedId(), 'profile', 'view');
     $this->aFormPrivacy['inputs']['allow_view_to']['value'] = (string) $this->aProfiles[0]['allow_view_to'];
     $oForm = new BxTemplFormView($this->aFormPrivacy);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iProfileId = (int) $_POST['profile_id'];
         $iAllowViewTo = (int) $_POST['allow_view_to'];
         if ((int) db_res("UPDATE `Profiles` SET `allow_view_to`='" . $iAllowViewTo . "' WHERE `ID`='" . $iProfileId . "' LIMIT 1") > 0) {
             $sStatusText = '_Save profile successful';
         }
     }
     if ($sStatusText) {
         $sStatusText = MsgBox(_t($sStatusText), 3);
     }
     return $sStatusText . $oForm->getCode();
 }
Пример #13
0
 /**
  * 'add' action handler
  */
 public function performActionAdd()
 {
     $sAction = 'add';
     $aForm = array('form_attrs' => array('id' => 'sample-add-form', 'action' => 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => 'post'), 'params' => array('db' => array('table' => 'sample_grid_data', 'key' => 'ID', 'submit_name' => 'do_submit')), 'inputs' => array('NickName' => array('type' => 'text', 'name' => 'NickName', 'caption' => _t('Username'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('Username is required')), 'db' => array('pass' => 'Xss')), 'Email' => array('type' => 'text', 'name' => 'Email', 'caption' => _t('Email'), 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email')), 'db' => array('pass' => 'Xss')), 'City' => array('type' => 'text', 'name' => 'City', 'caption' => _t('City'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(1, 150), 'error' => _t('City is required')), 'db' => array('pass' => 'Xss')), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('Close'), 'attrs' => array('onclick' => "\$('.dolPopup:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $iNewId = $oForm->insert(array(), true);
         // insert record to database
         if ($iNewId) {
             $aRes = array('grid' => $this->getCode(true), 'blink' => $iNewId);
         } else {
             $aRes = array('msg' => "Error occured");
         }
         // if record adding failed, display error message
         $this->_echoResultJson($aRes, true);
     } else {
         // if form is not submitted or some fields are invalid, display popup with form
         bx_import('BxTemplFunctions');
         // we need to use 'transBox' function to properly display 'popup'
         $s = BxTemplFunctions::getInstance()->transBox('', '
             <div class="bx-def-padding-top bx-def-padding-left bx-def-padding-right bx-def-color-bg-block" style="width:300px;">' . $oForm->getCode() . '</div>
             <script>
                 $(document).ready(function () {
                     $("#sample-add-form").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $aForm['form_attrs']['id'] . '"), true);
                         },
                         success: function (data) {
                             $(".dolPopup:visible").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "' . $sAction . '");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Пример #14
0
 /**
  * Function will generate the poll's creation form ;
  *
  * @return : (text) - Html presentation data ;
  */
 function getCreationForm()
 {
     // check membership;
     if (!$this->isPollCreateAlowed($this->aPollSettings['member_id'], false)) {
         return MsgBox(_t('_bx_poll_access_denied'));
     }
     $iDefaultAnswerCount = 2;
     $aLanguageKeys = array('create' => _t('_bx_poll_create'), 'tags' => _t('_bx_poll_tags'), 'tags_sep' => _t('_sys_tags_note'), 'generate' => _t('_bx_poll_generate'), 'question' => _t('_bx_poll_question'), 'answer' => _t('_bx_poll_answer'), 'add_answer' => _t('_bx_poll_add'), 'max_pool' => _t('_bx_poll_max_reached'), 'question_length_req' => _t('_bx_poll_question_length_required', $this->aPollSettings['question_min_length'], $this->aPollSettings['question_max_length']), 'answer_length_req' => _t('_bx_poll_answer_length_required', $this->aPollSettings['answer_min_length'], $this->aPollSettings['answer_max_length']));
     $aForm = array('form_attrs' => array('action' => $this->sPathToModule . '&mode=' . $this->aPollSettings['mode'], 'method' => 'post', 'name' => 'poll_creation_form'), 'params' => array('checker_helper' => 'BxCheckerPoll', 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('question' => array('type' => 'text', 'name' => 'question', 'caption' => $aLanguageKeys['question'], 'required' => true, 'checker' => array('func' => 'length', 'params' => array($this->aPollSettings['question_min_length'], $this->aPollSettings['question_max_length']), 'error' => $aLanguageKeys['question_length_req'])), 'answers' => array('type' => 'text', 'name' => 'answers[]', 'caption' => $aLanguageKeys['answer'], 'required' => true, 'value' => array('', ''), 'attrs' => array('multiplyable' => 'true'), 'checker' => array('func' => 'answers', 'params' => array($this->aPollSettings['answer_min_length'], $this->aPollSettings['answer_max_length']), 'error' => $aLanguageKeys['answer_length_req']), 'db' => array('pass' => 'Anwers')), 'category' => array(), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => $aLanguageKeys['tags'], 'required' => false, 'info' => $aLanguageKeys['tags_sep']), 'allow_view_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'view', array(), _t('_bx_poll_allow_view')), 'allow_comments_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'comment', array(), _t('_bx_poll_allow_comment')), 'allow_vote_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'vote', array(), _t('_bx_poll_allow_vote'))));
     // generate categories;
     $oCategories = new BxDolCategories();
     $oCategories->getTagObjectConfig();
     $aForm['inputs']['category'] = $oCategories->getGroupChooser('bx_poll', $this->aPollSettings['member_id'], true);
     // add submit button;
     $aForm['inputs'][] = array('type' => 'submit', 'name' => 'do_submit', 'value' => $aLanguageKeys['generate']);
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     // create new poll
     if ($oForm->isSubmittedAndValid()) {
         $this->proccesData();
         $sOutputCode .= $this->sActionAnswer;
     } else {
         $sOutputCode .= $oForm->getCode();
     }
     return $this->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sOutputCode));
 }
Пример #15
0
/**
 * Change member's menu position ;
 *
 * @param $iProfileId integer
 * @param $sMenuPosition string
 * @param $sAction string
 * @return text - html presentation data
 */
function PageListMemberMenuSettings($iProfileId, $sAction)
{
    $iProfileId = (int) $iProfileId;
    // define default menu position;
    if (isset($_COOKIE['menu_position'])) {
        $sDefaultValue = clear_xss($_COOKIE['menu_position']);
    } else {
        $sDefaultValue = getParam('ext_nav_menu_top_position');
    }
    //get form
    $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'list_pop.php?action=' . clear_xss($sAction), 'method' => 'post', 'name' => 'menu_position_form'), 'params' => array('db' => array('submit_name' => 'do_submit')), 'inputs' => array(array('type' => 'radio_set', 'name' => 'menu_settings', 'caption' => 'Position', 'dv' => '<br />', 'values' => array('top' => _t('_Top'), 'bottom' => _t('_Bottom'), 'static' => _t('_Static')), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 6), 'error' => _t('_Error occured')), 'value' => $sDefaultValue, 'db' => array('pass' => 'Xss')), array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Save Changes'))));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        $sCode = MsgBox(_t('_Saved'));
        $sCode .= '
            <script type="text/javascript">
                opener.location.reload();
                window.close();
            </script>
        ';
        //change menu position
        setcookie("menu_position", $oForm->getCleanValue('menu_settings'), time() + 60 * 60 * 24 * 180);
        //clear member menu cache
        bx_import('BxDolMemberMenu');
        $oMemberMenu = new BxDolMemberMenu();
        $oMemberMenu->deleteMemberMenuKeyFile($iProfileId);
    } else {
        $sCode = $oForm->getCode();
    }
    return $sCode;
}
Пример #16
0
        if (!$iID) {
            return _t('_MEMBER_NOT_RECOGNIZED', $site['title']);
        }
        return true;
    }
}
// --------------- page variables and login
$_page['name_index'] = 1;
$logged['member'] = member_auth(0, false);
$_page['header'] = _t("_Forgot password?");
$_page['header_text'] = _t("_Password retrieval", $site['title']);
// --------------- page components
$_ni = $_page['name_index'];
$aForm = array('form_attrs' => array('name' => 'forgot_form', 'action' => BX_DOL_URL_ROOT . 'forgot.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'do_submit'), 'checker_helper' => 'BxDolForgotCheckerHelper'), 'inputs' => array(array('type' => 'email', 'name' => 'Email', 'caption' => _t('_My Email'), 'value' => isset($_POST['Email']) ? $_POST['Email'] : '', 'required' => true, 'checker' => array('func' => 'email', 'error' => _t('_Incorrect Email'))), array('type' => 'captcha', 'name' => 'captcha', 'caption' => _t('_Enter Captcha'), 'required' => true, 'checker' => array('func' => 'captcha', 'error' => _t('_Incorrect Captcha'))), array('type' => 'submit', 'name' => 'do_submit', 'value' => _t("_Retrieve my information"))));
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
    // Check if entered email is in the base
    $sEmail = process_db_input($_POST['Email'], BX_TAGS_STRIP);
    $memb_arr = db_arr("SELECT `ID` FROM `Profiles` WHERE `Email` = '{$sEmail}'");
    $recipient = $sEmail;
    $rEmailTemplate = new BxDolEmailTemplates();
    $aTemplate = $rEmailTemplate->getTemplate('t_Forgot', $memb_arr['ID']);
    $aPlus['Password'] = generateUserNewPwd($memb_arr['ID']);
    $aProfile = getProfileInfo($memb_arr['ID']);
    $mail_ret = sendMail($recipient, $aTemplate['Subject'], $aTemplate['Body'], $memb_arr['ID'], $aPlus, 'html', false, true);
    // create system event
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
    $oZ = new BxDolAlerts('profile', 'password_restore', $memb_arr['ID']);
    $oZ->alert();
    $_page['header'] = _t("_Recognized");
Пример #17
0
 /**
  * 'recheck' action handler
  */
 public function performActionAdd()
 {
     bx_import('BxTemplFormView');
     $aForm = array('form_attrs' => array('id' => 'bx_antispam_form_dnsbl_add', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=bx_antispam_grid_dnsbl&a=add', 'method' => 'post'), 'params' => array('db' => array('table' => 'bx_antispam_dnsbl_rules', 'key' => 'id', 'submit_name' => 'do_submit')), 'inputs' => array('country' => array('type' => 'select', 'name' => 'country', 'caption' => _t('_bx_antispam_field_country'), 'values' => BxDolForm::getDataItems('Country')), 'chain' => array('type' => 'radio_set', 'name' => 'chain', 'caption' => _t('_bx_antispam_field_action'), 'values' => array('spammers' => _t('_bx_antispam_chain_spammers'), 'whitelist' => _t('_bx_antispam_chain_whitelist')), 'value' => 'spammers'), 'submit' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_sys_submit')), 1 => array('type' => 'reset', 'name' => 'close', 'value' => _t('_sys_close'), 'attrs' => array('class' => 'bx-def-margin-sec-left', 'onclick' => '$(\'.bx-popup-applied:visible\').dolPopupHide();')))));
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $aCustomValues = array('chain' => $oForm->getCleanValue('chain'), 'zonedomain' => sprintf("%s.countries.nerd.dk.", strtolower($oForm->getCleanValue('country'))), 'postvresp' => '127.0.0.2', 'url' => 'http://countries.nerd.dk/', 'comment' => '_bx_antispam_rule_note_country', 'added' => time(), 'active' => 1);
         $iRecentId = $oForm->insert($aCustomValues, true);
         // insert new record
         if ($iRecentId) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iRecentId);
         } else {
             $aRes = array('msg' => _t('_sys_txt_error_occured'));
         }
         // if record adding failed, display error message
         $this->_echoResultJson($aRes, true);
     } else {
         // if form is not submitted or some fields are invalid, display popup with form
         bx_import('BxTemplFunctions');
         $s = BxTemplFunctions::getInstance()->popupBox($oForm->getId() . '_form', _t('_bx_antispam_popup_dnsbl_add'), $oForm->getCode() . '
             <script>
                 $(document).ready(function () {
                     $("#' . $oForm->getId() . '").ajaxForm({
                         dataType: "json",
                         beforeSubmit: function (formData, jqForm, options) {
                             bx_loading($("#' . $oForm->getId() . '"), true);
                         },
                         success: function (data) {
                             $(".bx-popup-applied:visible").dolPopupHide();
                             glGrids.' . $this->_sObject . '.processJson(data, "add");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
Пример #18
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) $_POST['msgs_id'];
    $sSubject = $sBody = "";
    if ($_POST['body'] && $_POST['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`='" . $sMessageID . "' LIMIT 1", MYSQL_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, '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);
}
Пример #19
0
function PageCodeCreate()
{
    $aForm = array('form_attrs' => array('id' => 'adm-mlevels-create', 'action' => $GLOBALS['site']['url_admin'] . 'memb_levels.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_acl_levels', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'submit')), 'inputs' => array('Active' => array('type' => 'hidden', 'name' => 'Active', 'value' => 'no', 'db' => array('pass' => 'Xss')), 'Purchasable' => array('type' => 'hidden', 'name' => 'Purchasable', 'value' => 'yes', 'db' => array('pass' => 'Xss')), 'Removable' => array('type' => 'hidden', 'name' => 'Removable', 'value' => 'yes', 'db' => array('pass' => 'Xss')), 'Name' => array('type' => 'text', 'name' => 'name', 'caption' => _t('_adm_txt_mlevels_name'), 'value' => '', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_adm_txt_mlevels_name_err'))), 'Icon' => array('type' => 'file', 'name' => 'Icon', 'caption' => _t('_adm_txt_mlevels_icon'), 'value' => '', 'checker' => array('func' => '', 'params' => '', 'error' => _t('_adm_txt_mlevels_icon_err'))), 'Description' => array('type' => 'textarea', 'name' => 'description', 'caption' => _t('_adm_txt_mlevels_description'), 'value' => '', 'db' => array('pass' => 'XssHtml')), 'submit' => array('type' => 'submit', 'name' => 'submit', 'value' => _t('_adm_btn_mlevels_add'))));
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    $bFile = true;
    $sFilePath = BX_DIRECTORY_PATH_ROOT . 'media/images/membership/';
    $sFileName = time();
    $sFileExt = '';
    if ($oForm->isSubmittedAndValid() && ($bFile = isImage($_FILES['Icon']['type'], $sFileExt) && !empty($_FILES['Icon']['tmp_name']) && move_uploaded_file($_FILES['Icon']['tmp_name'], $sFilePath . $sFileName . '.' . $sFileExt))) {
        $sPath = $sFilePath . $sFileName . '.' . $sFileExt;
        imageResize($sPath, $sPath, 110, 110);
        $iId = (int) $oForm->insert(array('Icon' => $sFileName . '.' . $sFileExt));
        if ($iId != 0) {
            addStringToLanguage("_adm_txt_mp_" . strtolower(bx_get('name')), bx_get('name'));
        }
        header('Location: ' . $oForm->aFormAttrs['action']);
    } else {
        if (!$bFile) {
            $oForm->aInputs['Icon']['error'] = $oForm->aInputs['Icon']['checker']['error'];
        }
        return DesignBoxAdmin(_t('_adm_box_cpt_mlevel_create'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode())));
    }
}
Пример #20
0
function _getLevelsCreateForm($iLevelId, $bActive = false)
{
    $sSubmitUrl = BX_DOL_URL_ADMIN . 'memb_levels.php';
    $aLevel = array();
    if (($bEdit = $iLevelId != 0) === true) {
        $aLevel = $GLOBALS['MySQL']->getRow("SELECT `Name` AS `Name`, `Description` AS `Description`, `Order` AS `Order` FROM `sys_acl_levels` WHERE `ID`='" . $iLevelId . "' LIMIT 1");
    }
    $aForm = array('form_attrs' => array('id' => 'adm-mlevels-create', 'action' => $sSubmitUrl . '?tab=levels_add', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_acl_levels', 'key' => 'ID', 'uri' => '', 'uri_title' => '', 'submit_name' => 'Submit')), 'inputs' => array('Active' => array('type' => 'hidden', 'name' => 'Active', 'value' => 'no', 'db' => array('pass' => 'Xss')), 'Purchasable' => array('type' => 'hidden', 'name' => 'Purchasable', 'value' => 'yes', 'db' => array('pass' => 'Xss')), 'Removable' => array('type' => 'hidden', 'name' => 'Removable', 'value' => 'yes', 'db' => array('pass' => 'Xss')), 'Name' => array('type' => 'text', 'name' => 'Name', 'caption' => _t('_adm_txt_mlevels_name'), 'value' => isset($aLevel['Name']) ? $aLevel['Name'] : '', 'required' => true, 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'length', 'params' => array(3, 100), 'error' => _t('_adm_txt_mlevels_name_err'))), 'Icon' => array('type' => 'file', 'name' => 'Icon', 'caption' => _t('_adm_txt_mlevels_icon'), 'required' => true, 'checker' => array('func' => '', 'params' => '', 'error' => _t('_adm_txt_mlevels_icon_err'))), 'Description' => array('type' => 'textarea', 'name' => 'Description', 'caption' => _t('_adm_txt_mlevels_description'), 'value' => isset($aLevel['Description']) ? $aLevel['Description'] : '', 'db' => array('pass' => 'XssHtml')), 'Order' => array('type' => 'text', 'name' => 'Order', 'caption' => _t('_adm_txt_mlevels_order'), 'value' => isset($aLevel['Order']) ? $aLevel['Order'] : 0, 'required' => true, 'db' => array('pass' => 'Int'), 'checker' => array('func' => 'preg', 'params' => array('/^[1-9][0-9]*$/'), 'error' => _t('_adm_txt_mlevels_order_err'))), 'Submit' => array('type' => 'submit', 'name' => 'Submit', 'value' => _t('_adm_btn_mlevels_add'))));
    //--- Convert Add to Edit
    if ($bEdit) {
        unset($aForm['inputs']['Active']);
        unset($aForm['inputs']['Purchasable']);
        unset($aForm['inputs']['Removable']);
        unset($aForm['inputs']['Icon']);
        $aForm['form_attrs']['action'] = $sSubmitUrl . '?action=edit&level=' . $iLevelId;
        $aForm['inputs']['Submit']['value'] = _t('_adm_btn_mlevels_save');
        $aForm['inputs']['ID'] = array('type' => 'hidden', 'name' => 'ID', 'value' => $iLevelId, 'db' => array('pass' => 'Int'));
    }
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        //--- Add new level
        if (!$bEdit) {
            $sFilePath = BX_DIRECTORY_PATH_ROOT . 'media/images/membership/';
            $sFileName = time();
            $sFileExt = '';
            if ($GLOBALS['MySQL']->getOne("SELECT `Name` FROM `sys_acl_levels` WHERE `Name`='" . $oForm->getCleanValue('Name') . "' LIMIT 1")) {
                $oForm->aInputs['Name']['error'] = _t('_adm_txt_mlevels_name_err_non_uniq');
            } elseif (isImage($_FILES['Icon']['type'], $sFileExt) && !empty($_FILES['Icon']['tmp_name']) && move_uploaded_file($_FILES['Icon']['tmp_name'], $sFilePath . $sFileName . '.' . $sFileExt)) {
                $sPath = $sFilePath . $sFileName . '.' . $sFileExt;
                imageResize($sPath, $sPath, 110, 110);
                $iId = (int) $oForm->insert(array('Icon' => $sFileName . '.' . $sFileExt));
                if ($iId != 0) {
                    $sName = $oForm->getCleanValue('Name');
                    addStringToLanguage('_adm_txt_mp_' . strtolower($sName), $sName);
                }
                header('Location: ' . $sSubmitUrl);
                exit;
            } else {
                $oForm->aInputs['Icon']['error'] = $oForm->aInputs['Icon']['checker']['error'];
            }
        } else {
            $bResult = $oForm->update($iLevelId);
            if ($bResult !== false) {
                deleteStringFromLanguage('_adm_txt_mp_' . strtolower($aLevel['Name']));
                $sName = $oForm->getCleanValue('Name');
                addStringToLanguage('_adm_txt_mp_' . strtolower($sName), $sName);
            }
            header('Location: ' . $sSubmitUrl);
            exit;
        }
    }
    return $GLOBALS['oAdmTemplate']->parseHtmlByName('mlevels_create.html', array('display' => $bActive ? 'block' : 'none', 'form' => $oForm->getCode()));
}
Пример #21
0
    function getBlockCode_Membership()
    {
        if (!isAdmin()) {
            return;
        }
        $sUnlimited = process_line_output(_t('_pfm_unlimited'));
        $this->aFormMembership = array('form_attrs' => array('id' => 'profile_edit_membership', 'name' => 'profile_edit_membership', 'action' => BX_DOL_URL_ROOT . 'pedit.php?ID=' . $this->iProfileID, 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => '', 'uri' => '', 'uri_title' => '', 'submit_name' => 'save_membership')), 'inputs' => array('doSetMembership' => array('type' => 'hidden', 'name' => 'doSetMembership', 'value' => 'yes'), 'MembershipInfo' => array('type' => 'custom', 'caption' => _t('_Membership_current'), 'content' => ''), 'MembershipID' => array('type' => 'select', 'name' => 'MembershipID', 'caption' => _t('_Membership_name'), 'value' => '', 'values' => array(), 'required' => 0, 'attrs' => array('onchange' => 'checkStandard()'), 'checker' => array('func' => 'avail', 'params' => array(), 'error' => _t('_Membership_name_err_empty')), 'db' => array('pass' => 'Int')), 'MembershipDays' => array('type' => 'text', 'name' => 'MembershipDays', 'caption' => _t('_Membership_days'), 'value' => $sUnlimited, 'required' => 0, 'attrs' => array('onfocus' => "if(MembershipDays.value == '" . $sUnlimited . "') MembershipDays.value = ''", 'onblur' => "if(MembershipDays.value == '') MembershipDays.value = '" . $sUnlimited . "'"), 'info' => _t('_Membership_days_info'), 'db' => array('pass' => 'Xss')), 'MembershipImmediately' => array('type' => 'checkbox', 'name' => 'MembershipImmediately', 'caption' => _t('_Membership_starts'), 'value' => 'on', 'required' => 0, 'db' => array('pass' => 'Xss')), 'save_membership' => array('type' => 'submit', 'name' => 'save_membership', 'value' => _t('_Membership_save'))));
        $aMemberships = getMemberships();
        foreach ($aMemberships as $iId => $sName) {
            if ($iId != MEMBERSHIP_ID_NON_MEMBER) {
                $this->aFormMembership['inputs']['MembershipID']['values'][] = array('key' => $iId, 'value' => $sName);
            }
        }
        $oForm = new BxTemplFormView($this->aFormMembership);
        $oForm->initChecker();
        $sContent = "";
        if ($oForm->isSubmittedAndValid()) {
            $iMshipID = (int) $oForm->getCleanValue('MembershipID');
            $iMshipDays = (int) $oForm->getCleanValue('MembershipDays');
            //0 = unlim
            $bStartsNow = $oForm->getCleanValue('MembershipImmediately') == 'on';
            $bSave = setMembership($this->iProfileID, $iMshipID, $iMshipDays, $bStartsNow);
            $sContent .= MsgBox(_t($bSave ? '_Membership_save_msg_saved' : '_Membership_save_err_saved'), 3);
        }
        /**
         * Retrieve current membership info.
         */
        $aMembershipCurrent = getMemberMembershipInfo($this->iProfileID);
        $sMembershipCurrent = $aMembershipCurrent['Name'];
        if ($aMembershipCurrent['ID'] != MEMBERSHIP_ID_STANDARD) {
            $sMembershipCurrent .= ', ' . (!isset($aMembershipCurrent['DateExpires']) ? _t('_MEMBERSHIP_EXPIRES_NEVER') : _t('_MEMBERSHIP_EXPIRES', defineTimeInterval($aMembershipCurrent['DateExpires'])));
        }
        $oForm->aInputs['MembershipInfo']['content'] = $sMembershipCurrent;
        ob_start();
        ?>
        <script type="text/javascript">
        <!--
        function checkStandard()
        {
            var iId = parseInt($("[name='MembershipID']").val());
            if(iId == <?php 
        echo MEMBERSHIP_ID_STANDARD;
        ?>
) {
                $("[name='MembershipDays']").attr('disabled', 'disabled');
                $("[name='MembershipImmediately']").attr('disabled', 'disabled');
            } else {
                $("[name='MembershipDays']").removeAttr('disabled');
                $("[name='MembershipImmediately']").removeAttr('disabled');
            }
        }
        $(document).ready(function() {
            checkStandard();
        });
        -->
        </script>
<?php 
        $sContent .= ob_get_clean();
        return array($sContent . $oForm->getCode(), array(), array(), false);
    }
Пример #22
0
 function actionShare($sFileUri)
 {
     $sLangPref = '_' . $this->_oConfig->getMainPrefix() . '_';
     $sFileUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $sFileUri;
     $aForm = $this->getSubmitForm($sFileUri, 'share');
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         if ($this->sendFileInfo($_POST['email'], nl2br(process_pass_data($_POST['messageText'])), $sFileUrl, $_POST['mediaAction'])) {
             $sCode = $GLOBALS['oFunctions']->msgBox(_t('_File info was sent'));
         } else {
             $sCode = $GLOBALS['oFunctions']->msgBox(_t('_Error'));
         }
     } else {
         $sCode = $this->_oTemplate->parseHtmlByName('default_padding.html', array('content' => $oForm->getCode()));
         $sCode = $this->_oTemplate->parseHtmlByName('popup.html', array('title' => _t('_Share'), 'content' => $sCode));
         $sCode = $GLOBALS['oFunctions']->transBox($sCode, TRUE);
     }
     header('Content-type:text/html;charset=utf-8');
     echo $sCode;
     exit;
 }
Пример #23
0
 /**
  * Generate a Form to Create Blog
  *
  * @return HTML presentation of data
  */
 function GenCreateBlogForm($bBox = true)
 {
     $this->CheckLogged();
     if (!$this->isAllowedPostAdd()) {
         return $this->_oTemplate->displayAccessDenied();
     }
     $sRetHtml = $sCreateForm = '';
     $sActionsC = _t('_Actions');
     $sPleaseCreateBlogC = _t('_bx_blog_Please_create_blog');
     $sNoBlogC = _t('_bx_blog_No_blogs_available');
     $sMyBlogC = _t('_bx_blog_My_blog');
     $sNewBlogDescC = _t('_bx_blog_description');
     $sErrorC = _t('_bx_blog_create_blog_form_error');
     $sSubmitC = _t('_Submit');
     $sRetHtml .= MsgBox($sNoBlogC);
     if ($this->_iVisitorID || $this->isAdmin()) {
         $sRetHtml = MsgBox($sPleaseCreateBlogC);
         $sLink = $this->genBlogFormUrl();
         $sAddingForm = '';
         //adding form
         $aForm = array('form_attrs' => array('name' => 'CreateBlogForm', 'action' => $sLink, 'method' => 'post'), 'params' => array('db' => array('table' => $this->_oConfig->sSQLBlogsTable, 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('header1' => array('type' => 'block_header', 'caption' => $sPleaseCreateBlogC), 'Description' => array('type' => 'textarea', 'html' => 0, 'name' => 'Description', 'caption' => $sNewBlogDescC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 255), 'error' => $sErrorC), 'db' => array('pass' => 'XssHtml')), 'hidden_action' => array('type' => 'hidden', 'name' => 'action', 'value' => 'create_blog'), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sSubmitC)));
         $oForm = new BxTemplFormView($aForm);
         $oForm->initChecker();
         if ($oForm->isSubmittedAndValid()) {
             $this->CheckLogged();
             $iOwnID = $this->_iVisitorID;
             $aBlogsRes = $this->_oDb->getBlogInfo($iOwnID);
             if (!$aBlogsRes) {
                 $aValsAdd = array('OwnerID' => $iOwnID);
                 $iBlogID = $oForm->insert($aValsAdd);
                 //return $this->GenMemberBlog($iOwnID, false);
                 $bUseFriendlyLinks = $this->isPermalinkEnabled();
                 $sBlogAddLink = $bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'blogs/my_page/add/' : $this->genBlogFormUrl() . '?action=my_page&mode=add';
                 header('Location:' . $sBlogAddLink);
                 return $this->GenMyPageAdmin('add');
             } else {
                 return MsgBox($sErrorC);
             }
         } else {
             $sAddingForm = $oForm->getCode();
         }
         $aVars = array('content' => $sAddingForm);
         $sAddingForm = $this->_oTemplate->parseHtmlByName('default_padding.html', $aVars);
         $sCreateForm = $bBox ? DesignBoxContent($sActionsC, $sAddingForm, 1) : $sAddingForm;
     }
     $sMyBlogResult = $bBox ? DesignBoxContent($sMyBlogC, $sRetHtml, 1) : $sRetHtml;
     return $sMyBlogResult . $sCreateForm;
 }
Пример #24
0
 function actionEdit($iFileId)
 {
     $bAjax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? TRUE : FALSE;
     $iFileId = (int) $iFileId > 0 ? (int) $iFileId : (int) bx_get('fileId');
     if (!$iFileId || !$bAjax) {
         return;
     }
     $aManageArray = array('medTitle', 'medTags', 'medDesc', 'medProfId', 'Categories', 'AllowDownload', 'medUri');
     $aInfo = $this->_oDb->getFileInfo(array('fileId' => $iFileId), false, $aManageArray);
     $sLangPref = '_' . $this->_oConfig->getMainPrefix();
     if (!$this->isAllowedEdit($aInfo)) {
         $sCode = MsgBox(_t($sLangPref . '_access_denied')) . $sJsCode;
     } else {
         $oCategories = new BxDolCategories();
         $oCategories->getTagObjectConfig();
         $aCategories = $oCategories->getGroupChooser($this->_oConfig->getMainPrefix(), $this->_iProfileId, true);
         $aCategories['value'] = explode(CATEGORIES_DIVIDER, $aInfo['Categories']);
         $aAllowDownload = $this->oPrivacy->getGroupChooser($this->_iProfileId, $this->_oConfig->getUri(), 'download');
         $aAllowDownload['value'] = $aInfo['AllowDownload'];
         $sUrlPref = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri();
         $aForm = array('form_attrs' => array('id' => $sLangPref . '_upload_form', 'method' => 'post', 'action' => $sUrlPref . 'edit/' . $iFileId, 'onsubmit' => "return bx_ajax_form_check(this)"), 'params' => array('db' => array('submit_name' => 'do_submit'), 'checker_helper' => 'BxSupportCheckerHelper'), 'inputs' => array('header' => array('type' => 'block_header', 'caption' => _t('_Info')), 'title' => array('type' => 'text', 'name' => 'medTitle', 'caption' => _t('_Title'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_td_err_incorrect_length')), 'value' => $aInfo['medTitle']), 'tags' => array('type' => 'text', 'name' => 'medTags', 'caption' => _t('_Tags'), 'info' => _t('_Tags_desc'), 'value' => $aInfo['medTags']), 'description' => array('type' => 'textarea', 'name' => 'medDesc', 'caption' => _t('_Description'), 'value' => $aInfo['medDesc']), 'categories' => $aCategories, 'AllowDownload' => $aAllowDownload, 'fileId' => array('type' => 'hidden', 'name' => 'fileId', 'value' => $iFileId), 'medProfId' => array('type' => 'hidden', 'name' => 'medProfId', 'value' => $this->_iProfileId), 'do_submit' => array('type' => 'hidden', 'name' => 'do_submit', 'value' => 1), 'submit' => array('type' => 'submit', 'name' => 'submit_press', 'value' => _t('_Submit'), 'colspan' => true)));
         $oForm = new BxTemplFormView($aForm);
         $oForm->initChecker($aInfo);
         if ($oForm->isSubmittedAndValid()) {
             $aValues = array();
             array_pop($aManageArray);
             foreach ($aManageArray as $sKey) {
                 if ($sKey != 'Categories') {
                     $aValues[$sKey] = $_POST[$sKey];
                 } else {
                     $aValues[$sKey] = implode(CATEGORIES_DIVIDER, $_POST[$sKey]);
                 }
             }
             if ($this->_oDb->updateData($iFileId, $aValues)) {
                 $sType = $this->_oConfig->getMainPrefix();
                 bx_import('BxDolCategories');
                 $oTag = new BxDolTags();
                 $oTag->reparseObjTags($sType, $iFileId);
                 $oCateg = new BxDolCategories();
                 $oCateg->reparseObjTags($sType, $iFileId);
                 $sCode = $GLOBALS['oFunctions']->msgBox(_t($sLangPref . '_save_success'), 3, 'window.location="' . $sUrlPref . 'view/' . $aInfo['medUri'] . '";');
             } else {
                 $sCode = $GLOBALS['oFunctions']->msgBox(_t('_sys_save_nothing'));
             }
         } else {
             $sCode = $this->_oTemplate->parseHtmlByName('default_padding.html', array('content' => $oForm->getCode()));
             $sCode = $this->_oTemplate->parseHtmlByName('popup.html', array('title' => $aInfo['medTitle'], 'content' => $sCode));
             $sCode = $GLOBALS['oFunctions']->transBox($sCode, TRUE);
         }
     }
     header('Content-type:text/html;charset=utf-8');
     echo $sCode;
     exit;
 }
Пример #25
0
 function getBlockCode_edit()
 {
     if (!in_array('edit', $this->aCurrentBlocks['blocks'])) {
         return '';
     }
     $aInfo = $this->oAlbum->getAlbumInfo(array('fileUri' => $this->aAddParams[1], 'owner' => $this->iOwnerId));
     if ($aInfo['Owner'] != $this->iOwnerId) {
         $sCode = MsgBox(_t('_Access denied'));
     }
     $oAlbumPrivacy = new BxVideosPrivacy('sys_albums', 'ID', 'Owner');
     $aPrivFieldView = $oAlbumPrivacy->getGroupChooser($this->iOwnerId, $this->oConfig->getUri(), 'album_view');
     $aPrivFieldView['value'] = $aInfo['AllowAlbumView'];
     $aReInputs = array('title' => array('name' => 'Caption', 'value' => $aInfo['Caption']), 'location' => array('name' => 'Location', 'value' => $aInfo['Location']), 'description' => array('name' => 'Description', 'value' => $aInfo['Description']), 'allow_view' => $aPrivFieldView, 'uri' => array('type' => 'hidden', 'name' => 'Uri', 'value' => $this->aAddParams[1]));
     $aReForm = array('id' => $this->oConfig->getMainPrefix() . '_upload_form', 'method' => 'post', 'action' => $this->oConfig->getBaseUri() . 'albums/my/edit/' . strip_tags($this->aAddParams[1] . '/' . strip_tags($this->aAddParams[2]) . '/' . strip_tags($this->aAddParams[3])));
     $aForm = $this->oTemplate->getAlbumFormEditArray($aReInputs, $aReForm);
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aFields = array('Caption', 'Location', 'Description', 'AllowAlbumView');
         $aData = array();
         foreach ($aFields as $sValue) {
             if (isset($_POST[$sValue])) {
                 $aData[$sValue] = $_POST[$sValue];
             }
         }
         if ($this->oAlbum->updateAlbum($_POST['Uri'], $aData)) {
             $sCode = MsgBox(_t('_' . $this->oConfig->getMainPrefix() . '_album_save_success'));
         }
     } else {
         $sCode = $oForm->getCode();
     }
     return array($sCode, $this->getTopMenu('edit'));
 }
Пример #26
0
 /**
  * Function will generate the edit poll's form ;
  *
  * @return : (text) - Html presentation data ;
  */
 function getEditForm()
 {
     if ($this->aPollSettings['edit_poll_id']) {
         $aPollInfo = $this->_oDb->getPollInfo($this->aPollSettings['edit_poll_id']);
         $aPollInfo = array_shift($aPollInfo);
         // check poll's permission;
         if ($this->aPollSettings['admin_mode'] || $aPollInfo['id_profile'] == $this->aPollSettings['member_id']) {
             $aLanguageKeys = array('question' => _t('_bx_poll_question'), 'answer' => _t('_bx_poll_answer'), 'save' => _t('_bx_poll_save'), 'close' => _t('_bx_poll_close'), 'active' => _t('_bx_poll_active'), 'approve' => _t('_bx_poll_approve'), 'tags' => _t('_bx_poll_tags'), 'tags_sep' => _t('_bx_poll_tags_separeted'), 'question_length_req' => _t('_bx_poll_question_length_required', $this->aPollSettings['question_min_length'], $this->aPollSettings['question_max_length']), 'answer_length_req' => _t('_bx_poll_answer_length_required', $this->aPollSettings['answer_min_length'], $this->aPollSettings['answer_max_length']));
             // generate edit form;
             $aForm = array('form_attrs' => array('action' => $this->sPathToModule . '&mode=' . $this->aPollSettings['mode'] . '&edit_poll_id=' . $this->aPollSettings['edit_poll_id'], 'method' => 'post', 'name' => 'poll_edit_form'), 'params' => array('checker_helper' => 'BxCheckerPoll', 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('question' => array('type' => 'text', 'name' => 'question', 'caption' => $aLanguageKeys['question'], 'required' => true, 'value' => $aPollInfo['poll_question'], 'checker' => array('func' => 'length', 'params' => array($this->aPollSettings['question_min_length'], $this->aPollSettings['question_max_length']), 'error' => $aLanguageKeys['question_length_req']))));
             //  generate answers list ;
             $aAnswers = explode(BX_POLL_ANS_DIVIDER, $aPollInfo['poll_answers']);
             $iIndex = 0;
             foreach ($aAnswers as $iKey => $sValue) {
                 if ($sValue) {
                     $iIndex++;
                     $aForm['inputs'][] = array('type' => 'text', 'name' => 'answers_' . $iIndex, 'caption' => $aLanguageKeys['answer'] . ' ' . $iIndex, 'required' => true, 'value' => $sValue, 'checker' => array('func' => 'length', 'params' => array($this->aPollSettings['answer_min_length'], $this->aPollSettings['answer_max_length']), 'error' => $aLanguageKeys['answer_length_req']));
                 }
             }
             // generate categories;
             $oCategories = new BxDolCategories();
             $oCategories->getTagObjectConfig();
             $aCurrentCategories = explode(CATEGORIES_DIVIDER, $aPollInfo['poll_categories']);
             $aForm['inputs']['category'] = $oCategories->getGroupChooser('bx_poll', $this->aPollSettings['member_id'], true, $aPollInfo['poll_categories']);
             $aForm['inputs']['category']['value'] = $aCurrentCategories;
             // generate tags el;
             $aForm['inputs'][] = array('type' => 'text', 'name' => 'tags', 'caption' => $aLanguageKeys['tags'], 'required' => false, 'info' => $aLanguageKeys['tags_sep'], 'value' => $aPollInfo['poll_tags']);
             $aForm['inputs'] = array_merge($aForm['inputs'], array('allow_view_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'view', array(), _t('_bx_poll_allow_view')), 'allow_comments_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'comment', array(), _t('_bx_poll_allow_comment')), 'allow_vote_to' => $this->oPrivacy->getGroupChooser($this->aPollSettings['member_id'], $this->aModuleInfo['uri'], 'vote', array(), _t('_bx_poll_allow_vote'))));
             // add status checkbox;
             $aForm['inputs'][] = array('type' => 'checkbox', 'name' => 'active', 'caption' => $aLanguageKeys['active'], 'attrs' => array('checked' => $aPollInfo['poll_status'] ? 'checked' : null));
             // add approve checkbox;
             if (isAdmin()) {
                 $aForm['inputs'][] = array('type' => 'checkbox', 'name' => 'approve', 'caption' => $aLanguageKeys['approve'], 'attrs' => array('checked' => $aPollInfo['poll_approval'] ? 'checked' : null));
             }
             // add submit button;
             $aForm['inputs'][] = array('type' => 'submit', 'name' => 'do_submit', 'value' => $aLanguageKeys['save']);
             $aForm['inputs']['allow_view_to']['value'] = (string) $aPollInfo['allow_view_to'];
             $aForm['inputs']['allow_comments_to']['value'] = (string) $aPollInfo['allow_comment_to'];
             $aForm['inputs']['allow_vote_to']['value'] = (string) $aPollInfo['allow_vote_to'];
             $oForm = new BxTemplFormView($aForm);
             $oForm->initChecker();
             // create new poll
             if ($oForm->isSubmittedAndValid()) {
                 $this->proccesData();
                 $sOutputCode = MsgBox(_t('_bx_poll_was_edited'));
             } else {
                 $sOutputCode = $oForm->getCode();
             }
         }
     }
     return $this->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sOutputCode));
 }
Пример #27
0
 function getForm($iUserId)
 {
     $aInputs = $this->_oDb->getForm();
     if (empty($aInputs)) {
         return '';
     }
     $sLangsPrefix = $this->_oConfig->getLangsPrefix();
     if ($iUserId == BX_PMT_ADMINISTRATOR_ID) {
         $this->_aForm['form_attrs']['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'admin/';
     }
     $bCollapsed = $this->_bCollapseFirst;
     $iProviderId = 0;
     $sProviderName = "";
     $aUserValues = $this->_oDb->getFormData($iUserId);
     foreach ($aInputs as $aInput) {
         $sReturnDataUrl = $this->_oConfig->getDataReturnUrl() . $sProviderName . '/' . $iUserId;
         if ($iProviderId != $aInput['provider_id']) {
             if (!empty($iProviderId)) {
                 $this->_aForm['inputs']['provider_' . $iProviderId . '_end'] = array('type' => 'block_end');
             }
             $this->_aForm['inputs']['provider_' . $aInput['provider_id'] . '_begin'] = array('type' => 'block_header', 'caption' => _t($aInput['provider_caption']), 'collapsable' => true, 'collapsed' => $bCollapsed);
             $iProviderId = $aInput['provider_id'];
             $sProviderName = $aInput['provider_name'];
             $bCollapsed = true;
         }
         $this->_aForm['inputs'][$aInput['name']] = array('type' => $aInput['type'], 'name' => $aInput['name'], 'caption' => _t($aInput['caption']), 'value' => $aUserValues[$aInput['id']]['value'], 'info' => _t($aInput['description']), 'attrs' => array('bx-data-provider' => $iProviderId), 'checker' => array('func' => $aInput['check_type'], 'params' => $aInput['check_params'], 'error' => _t($aInput['check_error'])));
         //--- Make some field dependent actions ---//
         switch ($aInput['type']) {
             case 'select':
                 if (empty($aInput['extra'])) {
                     break;
                 }
                 $aAddon = array('values' => array());
                 $aPairs = explode(',', $aInput['extra']);
                 foreach ($aPairs as $sPair) {
                     $aPair = explode('|', $sPair);
                     $aAddon['values'][] = array('key' => $aPair[0], 'value' => _t($aPair[1]));
                 }
                 break;
             case 'checkbox':
                 $this->_aForm['inputs'][$aInput['name']]['value'] = 'on';
                 $aAddon = array('checked' => $aUserValues[$aInput['id']]['value'] == 'on' ? true : false);
                 break;
             case 'value':
                 if (str_replace($aInput['provider_option_prefix'], '', $aInput['name']) == 'return_url') {
                     $this->_aForm['inputs'][$aInput['name']]['value'] = $sReturnDataUrl;
                 }
                 break;
         }
         if (!empty($aAddon) && is_array($aAddon)) {
             $this->_aForm['inputs'][$aInput['name']] = array_merge($this->_aForm['inputs'][$aInput['name']], $aAddon);
         }
     }
     $this->_aForm['inputs']['provider_' . $iProviderId . '_end'] = array('type' => 'block_end');
     $this->_aForm['inputs']['submit'] = array('type' => 'submit', 'name' => 'submit', 'value' => _t($sLangsPrefix . 'details_submit'));
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($this->_aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $aOptions = $this->_oDb->getOptions();
         foreach ($aOptions as $aOption) {
             $this->_oDb->updateOption($iUserId, $aOption['id'], process_db_input(isset($_POST[$aOption['name']]) ? $_POST[$aOption['name']] : "", BX_TAGS_STRIP));
         }
         header('Location: ' . $oForm->aFormAttrs['action']);
     } else {
         foreach ($oForm->aInputs as $aInput) {
             if (!empty($aInput['error'])) {
                 $iProviderId = (int) $aInput['attrs']['bx-data-provider'];
                 $oForm->aInputs['provider_' . $iProviderId . '_begin']['collapsed'] = false;
             }
         }
         return $oForm->getCode();
     }
 }
Пример #28
0
 function getEditForm($aValues, $aAddFields = array())
 {
     $oCategories = new BxDolCategories();
     if (isset($this->_aForm['inputs']['categories'])) {
         //--- convert post form to edit one ---//
         $this->_aForm['inputs']['categories'] = $oCategories->getGroupChooser($this->_oModule->_oConfig->getCategoriesSystemName(), $this->_iOwnerId, true, $aValues['categories']);
     }
     if (!empty($aValues) && is_array($aValues)) {
         foreach ($aValues as $sKey => $sValue) {
             if (array_key_exists($sKey, $this->_aForm['inputs'])) {
                 if ($this->_aForm['inputs'][$sKey]['type'] == 'checkbox') {
                     $this->_aForm['inputs'][$sKey]['checked'] = (int) $sValue == 1 ? true : false;
                 } else {
                     if ($this->_aForm['inputs'][$sKey]['type'] == 'select_box' && $this->_aForm['inputs'][$sKey]['name'] == 'Categories') {
                         $aCategories = preg_split('/[' . $oCategories->sTagsDivider . ']/', $sValue, 0, PREG_SPLIT_NO_EMPTY);
                         $this->_aForm['inputs'][$sKey]['value'] = $aCategories;
                     } else {
                         $this->_aForm['inputs'][$sKey]['value'] = $sValue;
                     }
                 }
             }
         }
         unset($this->_aForm['inputs']['author_id']);
         $this->_aForm['inputs']['id'] = array('type' => 'hidden', 'name' => 'id', 'value' => $aValues['id'], 'db' => array('pass' => 'Int'));
         $this->_aForm['inputs']['post']['value'] = _t("_td_edit");
     }
     $oForm = new BxTemplFormView($this->_aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iDateNow = mktime();
         $iDatePublish = $oForm->getCleanValue('when');
         if ($iDatePublish > $iDateNow) {
             $iStatus = BX_TD_STATUS_PENDING;
         } else {
             if ($iDatePublish <= $iDateNow && $this->_oModule->_oConfig->isAutoapprove()) {
                 $iStatus = BX_TD_STATUS_ACTIVE;
             } else {
                 $iStatus = BX_TD_STATUS_INACTIVE;
             }
         }
         $aDefFields = array('date' => $iDateNow, 'status' => $iStatus);
         $oForm->update($aValues['id'], array_merge($aDefFields, $aAddFields));
         //--- 'System' -> Edit for Alerts Engine ---//
         bx_import('BxDolAlerts');
         $oAlert = new BxDolAlerts($this->_oModule->_oConfig->getAlertsSystemName(), 'edit', $aValues['id'], $this->_iOwnerId);
         $oAlert->alert();
         //--- 'System' -> Edit for Alerts Engine ---//
         //--- Reparse Global Tags ---//
         $oTags = new BxDolTags();
         $oTags->reparseObjTags($this->_oModule->_oConfig->getTagsSystemName(), $aValues['id']);
         //--- Reparse Global Tags ---//
         //--- Reparse Global Categories ---//
         $oCategories->reparseObjTags($this->_oModule->_oConfig->getCategoriesSystemName(), $aValues['id']);
         //--- Reparse Global Categories ---//
         header('Location: ' . $oForm->aFormAttrs['action']);
     } else {
         return $oForm->getCode();
     }
 }
Пример #29
0
function getManageBannersBlock()
{
    $sAsNew = _t('_adm_bann_Insert_as_new');
    $sErrorC = _t('_Error Occured');
    $sApplyChangesC = _t('_Submit');
    $sTopC = _t('_Top');
    $sLeftC = _t('_adm_bann_Left');
    $sRightC = _t('_adm_bann_Right');
    $sBottomC = _t('_Bottom');
    $sHShiftC = _t('_adm_bann_HShift');
    $sVShiftC = _t('_adm_bann_VShift');
    $sTitleC = _t('_Title');
    $sUrlC = _t('_URL');
    $sActiveC = _t('_Active');
    $sTextC = _t('_Text');
    $sStartDateC = _t('_Start date');
    $sEndDateC = _t('_Expiration date');
    $sDefaultC = _t('_adm_bann_default');
    $sPositionOnPageC = _t('_adm_bann_Position_on_the_page');
    // get start & end dates
    $start_date_default = "2008-01-01 00:00:00";
    $end_date_default = "2015-01-01 00:00:00";
    $start_date = bx_get('start_date') !== false ? bx_get('start_date') : $start_date_default;
    $end_date = bx_get('end_date') !== false ? bx_get('end_date') : $end_date_default;
    $Title = $Url = $Active = $Text = $Position = $lhshift = $lvshift = $rhshift = $rvshift = '';
    $iBannerID = (int) $_GET['banner_id'];
    $action = "new";
    if ($iBannerID > 0 && !strlen(bx_get('action'))) {
        //banner edit
        $banns_arr = db_arr("SELECT * FROM `sys_banners` WHERE `ID`='{$iBannerID}'");
        $action = "modify";
        $Title = $banns_arr['Title'];
        $Url = $banns_arr['Url'];
        $Text = $banns_arr['Text'];
        $Active = $banns_arr['Active'];
        $Position = $banns_arr['Position'];
        $lhshift = $banns_arr['lhshift'];
        $lvshift = $banns_arr['lvshift'];
        $rhshift = $banns_arr['rhshift'];
        $rvshift = $banns_arr['rvshift'];
        list($iYearStart, $iMonthStart, $iDayStart) = explode('-', $banns_arr['campaign_start']);
        //$start_date = "{$iDayStart}/{$iMonthStart}/{$iYearStart}";
        $start_date = "{$iYearStart}-{$iMonthStart}-{$iDayStart} 00:00:00";
        list($iYearEnd, $iMonthEnd, $iDayEnd) = explode('-', $banns_arr['campaign_end']);
        //$end_date = "{$iDayEnd}/{$iMonthEnd}/{$iYearEnd}";
        $end_date = "{$iYearEnd}-{$iMonthEnd}-{$iDayEnd} 00:00:00";
    }
    $sFormTitle = htmlspecialchars($Title);
    $sFormUrl = htmlspecialchars($Url);
    $sFormActiveState = $Active ? 'checked="checked"' : '';
    $sFormActiveStateVal = $Active ? 'yes' : '';
    $sFormActiveStateChk = $Active ? true : false;
    $sFormBannerText = $Text;
    $sFormStartDate = $start_date;
    $sFormStartDateDef = $start_date_default;
    $sFormEndDate = $end_date;
    $sFormEndDateDef = $end_date_default;
    $sTopPosState = substr_count($Position, "1") > 0 ? 'checked="checked"' : '';
    $sLeftPosState = substr_count($Position, "2") > 0 ? 'checked="checked"' : '';
    $sRightPosState = substr_count($Position, "3") > 0 ? 'checked="checked"' : '';
    $sBottomPosState = substr_count($Position, "4") > 0 ? 'checked="checked"' : '';
    $sTopShift = substr_count($Position, "2") > 0 ? $lhshift : '';
    $sLeftShift = substr_count($Position, "2") > 0 ? $lvshift : '';
    $sRightShift = substr_count($Position, "3") > 0 ? $rhshift : '';
    $sBottomShift = substr_count($Position, "3") > 0 ? $rvshift : '';
    $sActionAdd = $action == "modify" ? $sAsNew . '&nbsp;<input type=checkbox name=as_new />' : '';
    $sCustomPositions = <<<EOF
<table border=0 width=100% cellspacing=10 cellpading=20>
\t<tr>
\t\t<td colspan=5 align=center><input type=checkbox name="pos_top" {$sTopPosState} />{$sTopC}</td>
\t</tr>
\t<tr>
\t\t<td colspan=2 align=center><input type=checkbox name="pos_left" {$sLeftPosState} />{$sLeftC}</td>
\t\t<td>&nbsp;</td>
\t\t<td colspan=2 align=center><input type=checkbox name="pos_right" {$sRightPosState} />{$sRightC}</td>
\t</tr>
\t<tr>
\t\t<td>{$sHShiftC}</td>
\t\t<td>{$sVShiftC}</td>
\t\t<td>&nbsp;</td>
\t\t<td>{$sHShiftC}</td>
\t\t<td>{$sVShiftC}</td>
\t</tr>
\t<tr>
\t\t<td><input name="lhshift" type=input size=5 value={$sTopShift} /></td>
\t\t<td><input name="lvshift" type=input size=5 value={$sLeftShift} /></td>
\t\t<td>&nbsp;</td>
\t\t<td><input name="rhshift" type=input size=5 value={$sRightShift} /></td>
\t\t<td><input name="rvshift" type=input size=5 value={$sBottomShift} /></td>
\t</tr>
\t<tr>
\t\t<td colspan=5 align=center><input type=checkbox name="pos_bottom" {$sBottomPosState} />{$sBottomC}</td>
\t</tr>
</table>
{$sActionAdd}
EOF;
    $aForm = array('form_attrs' => array('name' => 'apply_ip_list_form', 'action' => $GLOBALS['site']['url_admin'] . 'banners.php', 'method' => 'post'), 'params' => array('db' => array('table' => 'sys_banners', 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('BannerTitle' => array('type' => 'text', 'name' => 'Title', 'value' => $sFormTitle, 'caption' => $sTitleC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(2, 128), 'error' => _t('_chars_to_chars', 2, 128)), 'db' => array('pass' => 'Xss')), 'BannerUrl' => array('type' => 'text', 'name' => 'Url', 'value' => $sFormUrl, 'caption' => $sUrlC, 'required' => false, 'db' => array('pass' => 'Xss')), 'BannerActive' => array('type' => 'checkbox', 'name' => 'Active', 'caption' => $sActiveC, 'value' => 1, 'checked' => $sFormActiveStateChk), 'BannerText' => array('type' => 'textarea', 'name' => 'Text', 'value' => $sFormBannerText, 'caption' => $sTextC, 'required' => true, 'checker' => array('func' => 'length', 'params' => array(10, 32000), 'error' => _t('_chars_to_chars', 10, 32000)), 'db' => array('pass' => 'All')), 'StartDate' => array('type' => 'datetime', 'name' => 'start_date', 'value' => $sFormStartDate, 'caption' => $sStartDateC, 'label' => "{$sDefaultC}: {$sFormStartDateDef}", 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'display' => 'filterDate'), 'EndDate' => array('type' => 'datetime', 'name' => 'end_date', 'value' => $sFormEndDate, 'caption' => $sEndDateC, 'label' => "{$sDefaultC}: {$sFormEndDateDef}", 'required' => true, 'checker' => array('func' => 'DateTime', 'error' => $sErrorC), 'display' => 'filterDate'), 'Positions' => array('type' => 'custom', 'name' => 'Position', 'caption' => $sPositionOnPageC, 'content' => $sCustomPositions), 'ID' => array('type' => 'hidden', 'name' => 'banner_id', 'value' => $iBannerID), 'Action' => array('type' => 'hidden', 'name' => 'action', 'value' => $action), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sApplyChangesC)));
    $sResult = '';
    $oForm = new BxTemplFormView($aForm);
    $oForm->initChecker();
    if ($oForm->isSubmittedAndValid()) {
        list($iYearStart, $iMonthStart, $iDayStart) = explode('-', $oForm->getCleanValue('start_date'));
        $sDateStart = "{$iYearStart}-{$iMonthStart}-{$iDayStart}";
        list($iYearEnd, $iMonthEnd, $iDayEnd) = explode('-', $oForm->getCleanValue('end_date'));
        $sDateEnd = "{$iYearEnd}-{$iMonthEnd}-{$iDayEnd}";
        $sCurTime = date("Y-m-d");
        // 2010-12-31
        $iLastId = (int) $oForm->getCleanValue('banner_id');
        $banner_pos = "";
        if ($oForm->getCleanValue('pos_top') == "on") {
            $banner_pos .= '1';
        }
        if ($oForm->getCleanValue('pos_left') == "on") {
            $banner_pos .= '2';
        }
        if ($oForm->getCleanValue('pos_right') == "on") {
            $banner_pos .= '3';
        }
        if ($oForm->getCleanValue('pos_bottom') == "on") {
            $banner_pos .= '4';
        }
        $banner_pos = (int) $banner_pos;
        $banner_lhshift = (int) $oForm->getCleanValue('lhshift');
        $banner_lvshift = (int) $oForm->getCleanValue('lvshift');
        $banner_rhshift = (int) $oForm->getCleanValue('rhshift');
        $banner_rvshift = (int) $oForm->getCleanValue('rvshift');
        $aValsAdd = array('Position' => $banner_pos, 'Active' => '' != $oForm->getCleanValue('Active') ? 1 : 0, 'Created' => $sCurTime, 'campaign_start' => $sDateStart, 'campaign_end' => $sDateEnd, 'lhshift' => $banner_lhshift, 'lvshift' => $banner_lvshift, 'rhshift' => $banner_rhshift, 'rvshift' => $banner_rvshift);
        if ($oForm->getCleanValue('action') == 'modify' && $oForm->getCleanValue('as_new') != "on" && $iLastId > 0) {
            $oForm->update($iLastId, $aValsAdd);
        }
        if ($oForm->getCleanValue('action') == 'new' || $oForm->getCleanValue('as_new') == "on" && $oForm->getCleanValue('action') == 'modify') {
            $iLastId = $oForm->insert($aValsAdd);
        }
        $sResult = $iLastId > 0 ? MsgBox(_t('_Success'), 3) : MsgBox($sErrorC);
    }
    return DesignBoxContent(_t('_adm_bann_title'), $sResult . $oForm->getCode(), 1);
}
Пример #30
0
 function actionShare($sFileUri)
 {
     $aForm = $this->getSubmitForm($sFileUri, 'share');
     $oForm = new BxTemplFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         if ($this->sendFileInfo($_POST['email'], $_POST['messageText'], BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $sFileUri, $_POST['mediaAction'])) {
             $sCode = MsgBox(_t('_File info was sent')) . '<script language="javascript">window.setTimeout(function () { window.parent.close(); }, 3000); </script>';
         }
     } else {
         $sCode = $oForm->getCode();
         $this->aPageTmpl['css_name'] = array('forms_adv.css', 'explanation.css');
     }
     $this->aPageTmpl['name_index'] = 44;
     $this->aPageTmpl['header'] = _t('_' . $this->_oConfig->getMainPrefix() . '_action_share');
     $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode));
 }