本文整理汇总了PHP中BxTemplFormView::isSubmittedAndValid方法的典型用法代码示例。如果您正苦于以下问题:PHP BxTemplFormView::isSubmittedAndValid方法的具体用法?PHP BxTemplFormView::isSubmittedAndValid怎么用?PHP BxTemplFormView::isSubmittedAndValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BxTemplFormView
的用法示例。
在下文中一共展示了BxTemplFormView::isSubmittedAndValid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormCode
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();
}
}
示例2: _getList
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')));
}
示例3: PageCompPageMainCodeWithForm
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: getPostForm
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);
}
示例5: _getDefaults
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)));
}
示例6: PageCompMainCode
/**
* 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);
}
示例7: PageCodeEdit
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;
}
示例8: PageCodeInjections
function PageCodeInjections()
{
$aForm = array('form_attrs' => array('id' => 'adm-settings-injections', 'name' => 'adm-settings-injections', 'action' => $GLOBALS['site']['url_admin'] . 'basic_settings.php', 'method' => 'post'), 'params' => array('db' => array('submit_name' => 'save_injections')), 'inputs' => array('head' => array('type' => 'textarea', 'name' => 'head', 'caption' => _t('_adm_txt_settings_injection_head'), 'info' => _t('_adm_dsc_settings_injection_head')), 'body' => array('type' => 'textarea', 'name' => 'body', 'caption' => _t('_adm_txt_settings_injection_body'), 'info' => _t('_adm_dsc_settings_injection_body')), 'save_injections' => array('type' => 'submit', 'name' => 'save_injections', 'value' => _t("_adm_btn_settings_save"))));
$oForm = new BxTemplFormView($aForm);
$sResult = '';
if ($oForm->isSubmittedAndValid()) {
$b = $GLOBALS['MySQL']->res("UPDATE `sys_injections` SET `data` = '" . process_db_input($_POST['head']) . "' WHERE `name` = 'sys_head'");
$b |= $GLOBALS['MySQL']->res("UPDATE `sys_injections` SET `data` = '" . process_db_input($_POST['body']) . "' WHERE `name` = 'sys_body'");
if ($b) {
$GLOBALS['MySQL']->cleanCache('sys_injections.inc');
}
$sResult = MsgBox(_t($b ? '_Success' : '_Error'));
}
$oForm->aInputs['head']['value'] = $GLOBALS['MySQL']->getOne("SELECT `data` FROM `sys_injections` WHERE `name` = 'sys_head'");
$oForm->aInputs['body']['value'] = $GLOBALS['MySQL']->getOne("SELECT `data` FROM `sys_injections` WHERE `name` = 'sys_body'");
return DesignBoxAdmin(_t('_adm_box_cpt_injections'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $sResult . $oForm->getCode())));
}
示例9: PageCompPageMainCode
/**
* 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: getAddSubcatForm
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: getManagingForm
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();
}
示例12: array
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);
}
示例13: BxDolPrivacy
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();
}
示例14: getCreationForm
/**
* 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: PageCodeCreate
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())));
}
}