예제 #1
0
 public function performActionEdit($bUpdateGrid = false)
 {
     $sAction = 'edit';
     $sFormObject = $this->oModule->_oConfig->getObject('form_nav_item');
     $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_nav_item_edit');
     $aItem = $this->_getItem('getItems');
     if ($aItem === false) {
         $this->_echoResultJson(array());
         exit;
     }
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
     $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction . '&set=' . $this->sSet;
     $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_nav_btn_items_save');
     $this->fillInSelects($oForm->aInputs);
     $oForm->initChecker($aItem);
     if ($oForm->isSubmittedAndValid()) {
         if ($oForm->update($aItem['id']) !== false) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $aItem['id']);
         } else {
             $aRes = array('msg' => _t('_bx_dev_nav_err_items_edit'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-item-edit-popup', _t('_bx_dev_nav_txt_items_edit_popup', _t($aItem['title_system'])), $this->oModule->_oTemplate->parseHtmlByName('nav_add_item.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
예제 #2
0
 public function serviceLoginForm($sParams = '', $sForceRelocate = '')
 {
     if (isLogged()) {
         return false;
     }
     // get all auth types
     $aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
     $oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
     $sCustomHtmlBefore = '';
     $sCustomHtmlAfter = '';
     bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
     if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
         $oForm->aInputs['relocate']['value'] = $sForceRelocate;
     } elseif ('homepage' == $sForceRelocate) {
         $oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
     }
     $sFormCode = $oForm->getCode();
     $sJoinText = '';
     if (strpos($sParams, 'no_join_text') === false) {
         $sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div class="bx-def-font-align-center">' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
     }
     BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
     $sAuth = $this->serviceMemberAuthCode($aAuthTypes);
     return $sCustomHtmlBefore . $sAuth . $sFormCode . $sCustomHtmlAfter . $sJoinText;
 }
 public function performActionAdd()
 {
     $sAction = 'add';
     $aForm = array('form_attrs' => array('id' => 'adm-form-pre-list-create', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_form_pre_lists', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('module' => array('type' => 'hidden', 'name' => 'module', 'value' => BX_DOL_STUDIO_MODULE_CUSTOM, 'db' => array('pass' => 'Xss')), 'use_for_sets' => array('type' => 'hidden', 'name' => 'use_for_sets', 'value' => 1, 'db' => array('pass' => 'Int')), 'title' => array('type' => 'text_translatable', 'name' => 'title', 'caption' => _t('_adm_form_txt_pre_lists_title'), 'info' => _t('_adm_form_dsc_pre_lists_title'), 'value' => '_adm_form_txt_pre_lists', 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'LengthTranslatable', 'params' => array(3, 100, 'title'), 'error' => _t('_adm_form_err_pre_lists_title'))), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_form_btn_pre_lists_add')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_form_btn_pre_lists_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
     $oForm = new BxTemplStudioFormView($aForm);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         bx_import('BxDolStudioLanguagesUtils');
         $oLanguage = BxDolStudioLanguagesUtils::getInstance();
         $sLanguage = $oLanguage->getCurrentLangName(false);
         $sKey = BxDolForm::getSubmittedValue('title-' . $sLanguage, $aForm['form_attrs']['method']);
         $sKey = uriGenerate($sKey, 'sys_form_pre_lists', 'key', 'key');
         $iId = (int) $oForm->insert(array('key' => $sKey));
         if ($iId != 0) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
         } else {
             $aRes = array('msg' => _t('_adm_form_err_pre_lists_create'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-form-pre-list-create-popup', _t('_adm_form_txt_pre_lists_create_popup'), $this->_oTemplate->parseHtmlByName('form_add_list.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
예제 #4
0
 public function deleteConvo($iConversationId, $iProfileId = 0)
 {
     $aContentInfo = $this->getContentInfoById($iConversationId);
     if (!$aContentInfo) {
         return true;
     }
     // delete convo
     $sWhere = '';
     if ($iProfileId) {
         $sWhere = $this->prepare(" AND `collaborator` = ?", $iProfileId);
     }
     $sQuery = $this->prepare("DELETE FROM `" . $this->getPrefix() . "conv2folder` WHERE `conv_id` = ?", $iConversationId);
     if (!$this->query($sQuery . $sWhere)) {
         return false;
     }
     // delete whole conversation if there is no refencences to the conversation in conv2folder table
     $sQuery = $this->prepare("SELECT `id` FROM `" . $this->getPrefix() . "conv2folder` WHERE `conv_id` = ?", $iConversationId);
     if (!$this->getOne($sQuery)) {
         $CNF =& $this->_oConfig->CNF;
         bx_import('BxDolForm');
         $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
         return $oForm->delete((int) $iConversationId, $aContentInfo);
     }
     return true;
 }
예제 #5
0
 public function performActionAdd()
 {
     $sAction = 'add';
     $sMsg = $this->_oModule->isAllowedAdd();
     if ($sMsg !== CHECK_ACTION_RESULT_ALLOWED) {
         $this->_echoResultJson(array('msg' => $sMsg), true);
         return;
     }
     $oForm = BxDolForm::getObjectInstance('bx_sites', 'bx_sites_site_add');
     if (!$oForm) {
         $this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
         return;
     }
     $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
     $oForm->initChecker();
     if (!$oForm->isSubmittedAndValid()) {
         $sContent = BxTemplFunctions::getInstance()->popupBox('bx-sites-site-create-popup', _t('_bx_sites_grid_browse_popup_create'), $this->_oModule->_oTemplate->parseHtmlByName('block_create.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
         return;
     }
     $sDomain = $oForm->getCleanValue('domain');
     if ($this->_oModule->_oDb->isAccount(array('domain' => $sDomain))) {
         $this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_exists')), true);
         return;
     }
     $iAccountId = $oForm->insert(array('owner_id' => bx_get_logged_profile_id(), 'created' => time(), 'status' => BX_SITES_ACCOUNT_STATUS_UNCONFIRMED));
     if (!$iAccountId) {
         $this->_echoResultJson(array('msg' => _t('_bx_sites_txt_err_site_creation')), true);
         return;
     }
     $oAccount = $this->_oModule->getObject('Account');
     $oAccount->onAccountCreated($iAccountId);
     $sUrl = $this->_oModule->startSubscription($iAccountId);
     $this->_echoResultJson(array('eval' => 'window.open(\'' . $sUrl . '\', \'_self\');', 'popup_not_hide' => 1), true);
 }
예제 #6
0
 protected function _performAction($sAction, $sDisplay, $iId = 0)
 {
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance('bx_antispam_ip_table_form', $sDisplay);
     // get form instance for specified form object and display
     if (!$oForm) {
         $this->_echoResultJson(array('msg' => _t('_sys_txt_error_occured')), true);
         exit;
     }
     $oForm->addMarkers(array('grid_object' => $this->_sObject, 'grid_action' => $sAction));
     $aIpTableDirective = array();
     if ($iId) {
         bx_import('BxDolModule');
         $oModule = BxDolModule::getInstance('bx_antispam');
         $oAntispamIp = bx_instance('BxAntispamIP', array(), $oModule->_aModule);
         $aIpTableDirective = $oAntispamIp->getIpTableDirective($iId);
         $aIpTableDirective['From'] = long2ip($aIpTableDirective['From']);
         $aIpTableDirective['To'] = long2ip($aIpTableDirective['To']);
     }
     $oForm->initChecker($aIpTableDirective);
     if ($oForm->isSubmittedAndValid()) {
         // if form is submitted and all fields are valid
         $aCustomValues = array('From' => sprintf("%u", ip2long($oForm->getCleanValue('From'))), 'To' => sprintf("%u", ip2long($oForm->getCleanValue('To'))));
         if ($iId) {
             if ($oForm->update($iId, $aCustomValues)) {
                 // update record
                 $iRecentId = $iId;
             }
         } else {
             $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_form_ip_table_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, "' . $sAction . '");
                         }
                     });
                 });
             </script>');
         $this->_echoResultJson(array('popup' => array('html' => $s, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
예제 #7
0
 public function performActionEdit()
 {
     $sAction = 'edit';
     $sFormObject = $this->oModule->_oConfig->getObject('form_forms_prelist');
     $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_prelist_edit');
     $aList = $this->_getItem('getLists');
     if ($aList === false) {
         $this->_echoResultJson(array());
         exit;
     }
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
     $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
     $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules());
     $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_prelists_save');
     $oForm->initChecker($aList);
     if ($oForm->isSubmittedAndValid()) {
         if ($oForm->update($aList['id']) !== false) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $aList['id']);
         } else {
             $aRes = array('msg' => _t('_bx_dev_frm_err_prelists_edit'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prelist-edit-popup', _t('_bx_dev_frm_txt_prelists_edit_popup', _t($aList['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_list.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
예제 #8
0
 public function serviceLoginForm($sParams = '', $sForceRelocate = '')
 {
     if (isLogged()) {
         return false;
     }
     // get all auth types
     $aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
     // define additional auth types
     if ($aAuthTypes) {
         $aAddInputEl[''] = _t('_Basic');
         // procces all additional menu's items
         foreach ($aAuthTypes as $iKey => $aItems) {
             $aAddInputEl[$aItems['Link']] = _t($aItems['Title']);
         }
         $aAuthTypes = array('type' => 'select', 'caption' => _t('_Auth type'), 'values' => $aAddInputEl, 'value' => '', 'attrs' => array('onchange' => 'if (this.value) { location.href = "' . BX_DOL_URL_ROOT . '" + this.value }'));
     } else {
         $aAuthTypes = array('type' => 'hidden');
     }
     $oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
     $sCustomHtmlBefore = '';
     $sCustomHtmlAfter = '';
     bx_alert('profile', 'show_login_form', 0, 0, array('oForm' => $oForm, 'sParams' => &$sParams, 'sCustomHtmlBefore' => &$sCustomHtmlBefore, 'sCustomHtmlAfter' => &$sCustomHtmlAfter, 'aAuthTypes' => &$aAuthTypes));
     if ($sForceRelocate && 0 === mb_stripos($sForceRelocate, BX_DOL_URL_ROOT)) {
         $oForm->aInputs['relocate']['value'] = $sForceRelocate;
     } elseif ('homepage' == $sForceRelocate) {
         $oForm->aInputs['relocate']['value'] = BX_DOL_URL_ROOT;
     }
     $sFormCode = $oForm->getCode();
     $sJoinText = '';
     if (strpos($sParams, 'no_join_text') === false) {
         $sJoinText = '<hr class="bx-def-hr bx-def-margin-sec-topbottom" /><div>' . _t('_sys_txt_login_description', BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=create-account')) . '</div>';
     }
     BxDolTemplate::getInstance()->addJs(array('jquery.form.min.js'));
     return $sCustomHtmlBefore . $sFormCode . $sCustomHtmlAfter . $sJoinText;
 }
예제 #9
0
 /**
  * Add comments CSS/JS
  */
 public function addCssJs()
 {
     $this->_oTemplate->addCss(array('cmts.css'));
     $this->_oTemplate->addJs(array('jquery.anim.js', 'jquery.form.min.js', 'BxDolCmts.js'));
     $oForm = BxDolForm::getObjectInstance($this->_sFormObject, $this->_sFormDisplayPost);
     $oForm->addCssJs();
 }
예제 #10
0
 public function performActionDelete($aParams = array())
 {
     $iProfileId = $this->_oModule->getProfileId();
     $mixedAllowed = $this->_oModule->isAllowedDeleteRequest($iProfileId);
     if ($mixedAllowed !== true) {
         $this->_echoResultJson(array('msg' => $mixedAllowed));
         exit;
     }
     $iAffected = 0;
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $this->_echoResultJson(array());
         exit;
     }
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance($this->_oModule->_oConfig->getObject('form_request'), $this->_oModule->_oConfig->getObject('form_display_request_send'));
     $aIdsAffected = array();
     foreach ($aIds as $iId) {
         if (!$oForm->delete($iId)) {
             continue;
         }
         $this->_oModule->isAllowedDeleteRequest($iProfileId, true);
         $aIdsAffected[] = $iId;
         $iAffected++;
     }
     $this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t('_bx_invites_err_delete_request')));
 }
예제 #11
0
 function getAuthorAddon($aData, $oProfile)
 {
     $s = parent::getAuthorAddon($aData, $oProfile);
     if (!$aData['cat']) {
         return $s;
     }
     if (!($oCat = BxTemplCategory::getObjectInstance('bx_posts_cats'))) {
         return $s;
     }
     if (!($aCats = BxDolForm::getDataItems('bx_posts_cats')) || !isset($aCats[$aData['cat']])) {
         return $s;
     }
     $s = _t('_bx_posts_txt_category_link', $oCat->getCategoryUrl($aData['cat']), $aCats[$aData['cat']]) . '<br />' . $s;
     return $s;
 }
예제 #12
0
 function getLoginForm()
 {
     $oTemplate = BxDolStudioTemplate::getInstance();
     $sUrlRelocate = bx_get('relocate');
     if (empty($sUrlRelocate) || basename($sUrlRelocate) == 'index.php') {
         $sUrlRelocate = '';
     }
     $oTemplate->addJsTranslation(array('_adm_txt_login_username', '_adm_txt_login_password'));
     $sHtml = $oTemplate->parseHtmlByName('login_form.html', array('role' => BX_DOL_ROLE_ADMIN, 'csrf_token' => BxDolForm::genCsrfToken(true), 'relocate_url' => bx_html_attribute($sUrlRelocate), 'action_url' => BX_DOL_URL_ROOT . 'member.php', 'forgot_password_url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password')));
     $sHtml = $oTemplate->parseHtmlByName('login.html', array('form' => $this->transBox('bx-std-login-form-box', $sHtml, true)));
     $oTemplate->setPageNameIndex(BX_PAGE_CLEAR);
     $oTemplate->setPageParams(array('css_name' => array('forms.css', 'login.css'), 'js_name' => array('jquery-ui/jquery.ui.position.min.js', 'jquery.form.min.js', 'jquery.dolPopup.js', 'login.js'), 'header' => _t('_adm_page_cpt_login')));
     $oTemplate->setPageContent('page_main_code', $sHtml);
     $oTemplate->getPageCode();
 }
예제 #13
0
 public function performActionEdit()
 {
     $sAction = 'edit';
     $sFormObject = $this->oModule->_oConfig->getObject('form_forms_form');
     $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_form_edit');
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $iId = (int) bx_get('id');
         if (!$iId) {
             $this->_echoResultJson(array());
             exit;
         }
         $aIds = array($iId);
     }
     $iId = $aIds[0];
     $aForm = array();
     $this->oDb->getForms(array('type' => 'by_id', 'value' => $iId), $aForm, false);
     if (empty($aForm) || !is_array($aForm)) {
         $this->_echoResultJson(array());
         exit;
     }
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
     $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
     $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules());
     $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_forms_save');
     $aForm['form_attrs'] = BxDevFunctions::unserializeString($aForm['form_attrs']);
     $aForm['params'] = BxDevFunctions::unserializeString($aForm['params']);
     $oForm->initChecker($aForm);
     if ($oForm->isSubmittedAndValid()) {
         $sValue = BxDolForm::getSubmittedValue('form_attrs', $oForm->aFormAttrs['method']);
         $sValue = BxDevFunctions::serializeString($sValue);
         BxDolForm::setSubmittedValue('form_attrs', $sValue, $oForm->aFormAttrs['method']);
         $sValue = BxDolForm::getSubmittedValue('params', $oForm->aFormAttrs['method']);
         $sValue = BxDevFunctions::serializeString($sValue);
         BxDolForm::setSubmittedValue('params', $sValue, $oForm->aFormAttrs['method']);
         if ($oForm->update($iId) !== false) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
         } else {
             $aRes = array('msg' => _t('_bx_dev_frm_err_forms_edit'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-form-edit-popup', _t('_bx_dev_frm_txt_forms_edit_popup', _t($aForm['title'])), $this->oModule->_oTemplate->parseHtmlByName('form_add_form.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
예제 #14
0
 /**
  * Generate Table HTML code
  *
  * @return string
  */
 function genTable()
 {
     // add default className to attributes
     $this->aTableAttrs['class'] = 'form_advanced_table' . (isset($this->aTableAttrs['class']) ? ' ' . $this->aTableAttrs['class'] : '');
     // add CSRF token if it's needed.
     if ($GLOBALS['MySQL']->getParam('sys_security_form_token_enable') == 'on' && !defined('BX_DOL_CRON_EXECUTE') && (!isset($this->aParams['csrf']['disable']) || isset($this->aParams['csrf']['disable']) && $this->aParams['csrf']['disable'] !== true) && ($mixedCsrfToken = BxDolForm::getCsrfToken()) !== false) {
         $this->aInputs['csrf_token'] = array('type' => 'hidden', 'name' => 'csrf_token', 'value' => $mixedCsrfToken, 'db' => array('pass' => 'Xss'));
     }
     // generate table contents
     $sTableContent = '';
     foreach ($this->aInputs as $aInput) {
         $sTableContent .= $this->genRow($aInput);
     }
     $this->addCssJs($this->_isDateControl, $this->_isDateTimeControl);
     return $this->_sCodeAdd . $GLOBALS['oSysTemplate']->parseHtmlByName('form_content.html', array('wrapper_id' => $this->id, 'table_attrs' => $this->convertArray2Attrs($this->aTableAttrs), 'content' => $sTableContent));
 }
예제 #15
0
 public function actionDeleteProfileImg($iFileId, $iContentId, $sFieldPicture)
 {
     $aResult = array();
     $CNF =& $this->_oConfig->CNF;
     $oSrorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
     if (!($aFile = $oSrorage->getFile((int) $iFileId)) || !($aContentInfo = $this->_oDb->getContentInfoById($iContentId)) || $aContentInfo[$sFieldPicture] != (int) $iFileId) {
         $aResult = array('error' => 1, 'msg' => _t('_sys_storage_err_file_not_found'));
     }
     if (!$aResult && !isLogged() || !$aResult && $aFile['profile_id'] != bx_get_logged_profile_id() && !$this->_isModerator()) {
         $aResult = array('error' => 2, 'msg' => _t('_Access denied'));
     }
     $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD'], $this->_oTemplate);
     if (!$aResult && !$oForm->_deleteFile($iContentId, $sFieldPicture, (int) $iFileId, true)) {
         $aResult = array('error' => 3, 'msg' => _t('_Failed'));
     } elseif (!$aResult) {
         $aResult = array('error' => 0, 'msg' => '');
     }
     header('Content-Type: application/json; charset=utf-8');
     echo json_encode($aResult);
 }
예제 #16
0
 /**
  * SERVICE METHODS
  */
 public function serviceGetBlockForm()
 {
     $aDefaultFields = array('name', 'email', 'subject', 'body', 'do_submit');
     $mixedAllowed = $this->isAllowedContact();
     if ($mixedAllowed !== true) {
         return array('content' => MsgBox($mixedAllowed));
     }
     $sResult = '';
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject('form_contact'), $this->_oConfig->getObject('form_display_contact_send'), $this->_oTemplate);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $iId = $oForm->insert(array('uri' => $oForm->generateUri(), 'date' => time()));
         if ($iId !== false) {
             $sCustomFields = '';
             $aCustomFields = array();
             foreach ($oForm->aInputs as $aInput) {
                 if (in_array($aInput['name'], $aDefaultFields)) {
                     continue;
                 }
                 $aCustomFields[$aInput['name']] = bx_process_output($oForm->getCleanValue($aInput['name']));
                 $sCustomFields .= $aInput['caption'] . ': ' . $aCustomFields[$aInput['name']] . '<br />';
             }
             $aTemplateKeys = array('SenderName' => bx_process_output($oForm->getCleanValue('name')), 'SenderEmail' => bx_process_output($oForm->getCleanValue('email')), 'MessageSubject' => bx_process_output($oForm->getCleanValue('subject')), 'MessageBody' => bx_process_output(nl2br($oForm->getCleanValue('body')), BX_DATA_TEXT_MULTILINE), 'CustomFields' => $sCustomFields);
             $aTemplateKeys = array_merge($aTemplateKeys, $aCustomFields);
             bx_import('BxDolEmailTemplates');
             $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('bx_contact_contact_form_message', $aTemplateKeys);
             $sResult = '';
             $sRecipientEmail = $this->_oConfig->getEmail();
             if (sendMail($sRecipientEmail, $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM)) {
                 $this->onContact();
                 $sResult = '_ADM_PROFILE_SEND_MSG';
             } else {
                 $sResult = '_Email sent failed';
             }
             $sResult = MsgBox(_t($sResult));
         }
     }
     return array('content' => $sResult . $oForm->getCode());
 }
예제 #17
0
 public function performActionEdit()
 {
     $sAction = 'edit';
     $sFormObject = $this->oModule->_oConfig->getObject('form_nav_set');
     $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_nav_set_edit');
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $sId = bx_get('set_name');
         if (!$sId) {
             $this->_echoResultJson(array());
             exit;
         }
         $aIds = array($sId);
     }
     $sId = bx_process_input($aIds[0]);
     $aSet = array();
     $this->oDb->getSets(array('type' => 'by_name', 'value' => $sId), $aSet, false);
     if (empty($aSet) || !is_array($aSet)) {
         $this->_echoResultJson(array());
         exit;
     }
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
     $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
     $oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules());
     $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_displays_save');
     $oForm->initChecker($aSet);
     if ($oForm->isSubmittedAndValid()) {
         if ($oForm->update($sId) !== false) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $sId);
         } else {
             $aRes = array('msg' => _t('_bx_dev_nav_err_sets_edit'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-set-edit-popup', _t('_bx_dev_nav_txt_sets_edit_popup', _t($aSet['title'])), $this->_oTemplate->parseHtmlByName('nav_add_set.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
예제 #18
0
 /**
  * Get all categories list
  * @param $bDisplayEmptyCats display categories with no items, true by default
  * @return categories list html
  */
 public function getCategoriesList($bDisplayEmptyCats = true)
 {
     $a = BxDolForm::getDataItems($this->_aObject['list_name']);
     if (!$a) {
         return '';
     }
     $aVars = array('bx_repeat:cats' => array());
     foreach ($a as $sValue => $sName) {
         if (!$sValue) {
             continue;
         }
         $iNum = $this->getItemsNum($sValue);
         if (!$bDisplayEmptyCats && !$iNum) {
             continue;
         }
         $aVars['bx_repeat:cats'][] = array('url' => $this->getCategoryUrl($sValue), 'name' => $sName, 'value' => $sValue, 'num' => $iNum);
     }
     if (!$aVars['bx_repeat:cats']) {
         return '';
     }
     return $this->_oTemplate->parseHtmlByName('category_list.html', $aVars);
 }
예제 #19
0
 public function performActionEdit()
 {
     $sAction = 'edit';
     $sFormObject = $this->oModule->_oConfig->getObject('form_forms_display');
     $sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_display_edit');
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $iId = (int) bx_get('id');
         if (!$iId) {
             $this->_echoResultJson(array());
             exit;
         }
         $aIds = array($iId);
     }
     $iId = $aIds[0];
     $aDisplay = array();
     $iDisplay = $this->oDb->getDisplays(array('type' => 'by_id', 'value' => $iId), $aDisplay);
     if ($iDisplay != 1 || empty($aDisplay)) {
         $this->_echoResultJson(array());
         exit;
     }
     bx_import('BxDolForm');
     $oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
     $this->_fillDisplayForm($oForm, $sAction);
     $oForm->aInputs['controls'][0]['value'] = _t('_bx_dev_frm_btn_displays_save');
     $oForm->initChecker($aDisplay);
     if ($oForm->isSubmittedAndValid()) {
         if ($oForm->update($iId) !== false) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
         } else {
             $aRes = array('msg' => _t('_bx_dev_frm_err_displays_edit'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-display-edit-popup', _t('_bx_dev_frm_txt_displays_edit_popup', _t($aDisplay['title'])), $this->_oTemplate->parseHtmlByName('form_add_display.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
 public function performActionEdit()
 {
     $sAction = 'edit';
     $aMenu = $this->_getItem('getMenus');
     if ($aMenu === false) {
         $this->_echoResultJson(array());
         exit;
     }
     $oForm = $this->_getFormObject($sAction, $aMenu);
     if ($oForm->isSubmitted() && isset($oForm->aInputs['set_name'])) {
         $this->updateSetFields($oForm);
     }
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         //--- New Set Creation
         if ($oForm->getCleanValue('set_name') == $this->sCreateNew) {
             $sSetTitleValue = $oForm->getCleanValue('set_title');
             $sSetName = 'custom_' . $this->getSystemName($sSetTitleValue);
             $sSetTitleKey = '_adm_nav_txt_set_' . $sSetName;
             if ($this->oDb->addSet(array('set_name' => $sSetName, 'module' => BX_DOL_STUDIO_MODULE_CUSTOM, 'title' => $sSetTitleKey, 'deletable' => 1))) {
                 bx_import('BxDolStudioLanguagesUtils');
                 BxDolStudioLanguagesUtils::getInstance()->addLanguageString($sSetTitleKey, $sSetTitleValue);
                 BxDolForm::setSubmittedValue('set_name', $sSetName, $oForm->aFormAttrs['method']);
             }
         }
         unset($oForm->aInputs['set_title']);
         if ($oForm->update($aMenu['id']) !== false) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $aMenu['id']);
         } else {
             $aRes = array('msg' => _t('_adm_nav_err_menus_edit'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         bx_import('BxTemplStudioFunctions');
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-menu-edit-popup', _t('_adm_nav_txt_menus_edit_popup', _t($aMenu['title'])), $this->_oTemplate->parseHtmlByName('nav_add_menu.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
     }
 }
예제 #21
0
 function get($sName, $sPass = '******', $aParams = array(), $sType = '')
 {
     if (!$sPass) {
         $sPass = '******';
     }
     $this->_oChecker;
     $val = BxDolForm::getSubmittedValue($sName, $this->_sFormMethod);
     $mixedVal = call_user_func_array(array($this->_oChecker, 'pass' . ucfirst($sPass)), $aParams ? array_merge(array($val), $aParams) : array($val));
     if (is_array($mixedVal) && 'select_multiple' == $sType) {
         $mixedVal = serialize($mixedVal);
     }
     return $mixedVal;
 }
예제 #22
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);
     }
 }
예제 #23
0
 protected function _getFormObject($sAction = BX_CMT_ACTION_POST)
 {
     $sDisplayName = '_sFormDisplay' . ucfirst($sAction);
     return BxDolForm::getObjectInstance($this->_sFormObject, $this->{$sDisplayName});
 }
 public function performActionDelete()
 {
     $sAction = 'delete';
     $iAffected = 0;
     $aIds = bx_get('ids');
     if (!$aIds || !is_array($aIds)) {
         $this->_echoResultJson(array());
         exit;
     }
     $oLanguage = BxDolStudioLanguagesUtils::getInstance();
     $aList = array();
     $this->oDb->getLists(array('type' => 'by_key', 'value' => $this->sList), $aList, false);
     $aIdsAffected = array();
     foreach ($aIds as $iId) {
         $aValue = array();
         $this->oDb->getValues(array('type' => 'by_id', 'value' => (int) $iId), $aValue);
         if (!is_array($aValue) || empty($aValue)) {
             continue;
         }
         if ((int) $this->_delete($iId) <= 0) {
             continue;
         }
         $oLanguage->deleteLanguageString($aValue['lkey']);
         $oLanguage->deleteLanguageString($aValue['lkey2']);
         if ((int) $aList['use_for_sets'] != 1) {
             $bUseInSets = 1;
             $aValues = BxDolForm::getDataItems($this->sList);
             foreach ($aValues as $mixedValue => $sTitle) {
                 if (!$this->canUseForSet($mixedValue)) {
                     $bUseInSets = 0;
                     break;
                 }
             }
             if ($bUseInSets == 1) {
                 $this->oDb->updateList($aList['id'], array('use_for_sets' => $bUseInSets));
             }
         }
         $aIdsAffected[] = $iId;
         $iAffected++;
     }
     $this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t('_adm_form_err_pre_values_delete')));
 }
 public function performActionEdit($bUpdateGrid = false)
 {
     $sAction = 'edit';
     $aItem = $this->_getItem('getItems');
     if ($aItem === false) {
         $this->_echoResultJson(array());
         exit;
     }
     $oForm = $this->_getFormObject($sAction, $aItem);
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $bIconImageCur = is_numeric($aItem['icon']) && (int) $aItem['icon'] != 0;
         $bIconImageNew = !empty($_FILES['icon_image']['tmp_name']);
         $sIconFont = $oForm->getCleanValue('icon');
         $bIconFont = !empty($sIconFont);
         if ($bIconImageCur && ($bIconImageNew || $bIconFont)) {
             $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
             if (!$oStorage->deleteFile((int) $aItem['icon'], 0)) {
                 $this->_echoResultJson(array('msg' => _t('_adm_nav_err_items_icon_image_remove')), true);
                 return;
             }
         }
         $sIcon = $sIconFont;
         if ($bIconImageNew) {
             $oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
             $sIcon = $oStorage->storeFileFromForm($_FILES['icon_image'], false, 0);
             if ($sIcon === false) {
                 $this->_echoResultJson(array('msg' => _t('_adm_nav_err_items_icon_image') . $oStorage->getErrorString()), true);
                 return;
             }
             $oStorage->afterUploadCleanup($sIcon, 0);
         } else {
             if ($bIconImageCur && !$bIconFont) {
                 $sIcon = $aItem['icon'];
             }
         }
         BxDolForm::setSubmittedValue('icon', $sIcon, $oForm->aFormAttrs['method']);
         $sLink = $oForm->getCleanValue('link');
         $sLink = BxDolPermalinks::getInstance()->unpermalink($sLink);
         BxDolForm::setSubmittedValue('link', $sLink, $oForm->aFormAttrs['method']);
         $sSubmenu = $oForm->getCleanValue('submenu_object');
         if (!empty($sSubmenu)) {
             $sLink = $oForm->getCleanValue('link');
             if (empty($sLink)) {
                 BxDolForm::setSubmittedValue('link', 'javascript:void(0)', $oForm->aFormAttrs['method']);
             }
             BxDolForm::setSubmittedValue('target', '', $oForm->aFormAttrs['method']);
             BxDolForm::setSubmittedValue('onclick', 'bx_menu_popup(\'' . $sSubmenu . '\', this);', $oForm->aFormAttrs['method']);
         } else {
             $sOnClick = $oForm->getCleanValue('onclick');
             if (mb_substr($sOnClick, 0, 13) == 'bx_menu_popup') {
                 BxDolForm::setSubmittedValue('onclick', '', $oForm->aFormAttrs['method']);
             }
         }
         $sTarget = $oForm->getCleanValue('target');
         if ($sTarget === false && !in_array($aItem['target'], array('', '_blank'))) {
             unset($oForm->aInputs['target']);
         }
         if ($oForm->update($aItem['id']) !== false) {
             $aRes = array('grid' => $this->getCode(false), 'blink' => $aItem['id']);
         } else {
             $aRes = array('msg' => _t('_adm_nav_err_items_edit'));
         }
         $this->_echoResultJson($aRes, true);
     } else {
         $sTitle = _t($aItem['title']);
         $sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-item-edit-popup', _t('_adm_nav_txt_items_edit_popup', $sTitle != "" ? '"' . $sTitle . '"' : ''), $this->_oTemplate->parseHtmlByName('nav_add_item.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
         $aRes = array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false)));
         if ($bUpdateGrid) {
             $aRes = array_merge($aRes, array('grid' => $this->getCode(false), 'blink' => $aItem['id']));
         }
         $this->_echoResultJson($aRes, true);
     }
 }
예제 #26
0
 /**
  * Add location for the content from POST data
  * @param $iId content id
  * @param $sPrefix field prefix for POST data, or empty -  if no prefix
  * @param $oForm form to use to get POST data, or null - then new form instance will be created
  */
 public function locationsAddFromForm($iId, $sPrefix = '', $oForm = null)
 {
     if (!$this->locationsIsEnabled()) {
         return;
     }
     if ($sPrefix) {
         $sPrefix .= '_';
     }
     if (!$oForm) {
         $oForm = new BxDolForm(array(), false);
     }
     $this->locationsAdd($iId, $oForm->getCleanValue($sPrefix . 'lat'), $oForm->getCleanValue($sPrefix . 'lng'), $oForm->getCleanValue($sPrefix . 'country'), $oForm->getCleanValue($sPrefix . 'state'), $oForm->getCleanValue($sPrefix . 'city'), $oForm->getCleanValue($sPrefix . 'zip'));
 }
예제 #27
0
    /**
     * Generate Table HTML code
     *
     * @return string
     */
    function genTable()
    {
        // add default className to attributes
        $this->aTableAttrs['class'] = 'form_advanced_table' . (isset($this->aTableAttrs['class']) ? ' ' . $this->aTableAttrs['class'] : '');
        // default cellpadding
        if (!isset($this->aTableAttrs['cellpadding'])) {
            $this->aTableAttrs['cellpadding'] = 0;
        }
        // default cellspacing
        if (!isset($this->aTableAttrs['cellspacing'])) {
            $this->aTableAttrs['cellspacing'] = 0;
        }
        $sTableAttrs = $this->convertArray2Attrs($this->aTableAttrs);
        // add CSRF token if it's needed.
        if ($GLOBALS['MySQL']->getParam('sys_security_form_token_enable') == 'on' && (!isset($this->aParams['csrf']['disable']) || isset($this->aParams['csrf']['disable']) && $this->aParams['csrf']['disable'] !== true) && ($mixedCsrfToken = BxDolForm::getCsrfToken()) !== false) {
            $this->aInputs['csrf_token'] = array('type' => 'hidden', 'name' => 'csrf_token', 'value' => $mixedCsrfToken, 'db' => array('pass' => 'Xss'));
        }
        // generate table contents
        $sTableCont = '';
        foreach ($this->aInputs as $aInput) {
            $sTableCont .= $this->genRow($aInput);
        }
        $sOpenTbody = $this->getOpenTbody();
        $sCloseTbody = $this->getCloseTbody();
        // generate table
        $sTable = <<<BLAH
            <table {$sTableAttrs}>
                {$sOpenTbody}
                    {$sTableCont}
                {$sCloseTbody}
            </table>
BLAH;
        $this->addCssJs($this->_isDateControl, $this->_isDateTimeControl);
        return $sTable;
    }
 public function viewDataForm($iContentId, $sDisplay = false)
 {
     $CNF =& $this->_oModule->_oConfig->CNF;
     if (false === $sDisplay) {
         $sDisplay = $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW'];
     }
     // get content data and profile info
     list($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
     if (!$aContentInfo) {
         return MsgBox(_t('_sys_txt_error_entry_is_not_defined'));
     }
     // check access
     if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedView($aContentInfo))) {
         return MsgBox($sMsg);
     }
     // get form
     $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sDisplay, $this->_oModule->_oTemplate);
     if (!$oForm) {
         return MsgBox(_t('_sys_txt_error_occured'));
     }
     // process metatags
     if (!empty($CNF['OBJECT_METATAGS'])) {
         $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
         if ($oMetatags->keywordsIsEnabled()) {
             $aFields = $oMetatags->keywordsFields($aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']);
             $oForm->setMetatagsKeywordsData($iContentId, $aFields, $oMetatags);
         }
     }
     // display profile
     $oForm->initChecker($aContentInfo);
     return $oForm->getCode();
 }
예제 #29
0
 protected function onSaveBlock(&$oForm, &$aBlock)
 {
     parent::onSaveBlock($oForm, $aBlock);
     if ($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_SERVICE && isset($oForm->aInputs['content'])) {
         $sValue = $oForm->getCleanValue('content');
         $sValue = BxDevFunctions::serializeString($sValue);
         BxDolForm::setSubmittedValue('content', $sValue, $oForm->aFormAttrs['method']);
     }
 }
예제 #30
0
 /**
  * Display forgot password form, if reset password key is provided then reset password
  */
 public function serviceForgotPassword()
 {
     if (bx_get('key')) {
         return $this->resetPassword();
     }
     $oForm = BxDolForm::getObjectInstance('sys_forgot_password', 'sys_forgot_password');
     if (!$oForm) {
         return '';
     }
     $oForm->initChecker();
     if ($oForm->isSubmittedAndValid()) {
         $oKey = BxDolKey::getInstance();
         if (!$oKey) {
             $sResultMsg = MsgBox(_t("_sys_txt_forgot_pasword_error_occured"));
         } else {
             $sEmail = $oForm->getCleanValue('email');
             $iAccountId = $this->_oAccountQuery->getIdByEmail($sEmail);
             $aPlus['key'] = $oKey->getNewKey(array('email' => $sEmail));
             $aPlus['forgot_password_url'] = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=forgot-password') . '&key=' . $aPlus['key'];
             $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_Forgot', $aPlus, $iAccountId);
             if ($aTemplate && sendMail($sEmail, $aTemplate['Subject'], $aTemplate['Body'], 0, $aPlus, BX_EMAIL_SYSTEM)) {
                 $sResultMsg = MsgBox(_t("_sys_txt_forgot_pasword_check_email"));
             } else {
                 $sResultMsg = MsgBox(_t("_sys_txt_forgot_pasword_email_send_failed"));
             }
             $sForm = '';
         }
     } else {
         $sResultMsg = _t("_sys_txt_forgot_pasword_desc");
         $sForm = $oForm->getCode();
     }
     return '<div class="bx-def-padding-sec-bottom">' . $sResultMsg . '</div>' . $sForm;
 }