function BxDolTextData(&$oModule) { $this->_oModule = $oModule; $this->_iOwnerId = BxDolTextData::getAuthorId(); $oCategories = new BxDolCategories(); $oCategories->getTagObjectConfig(); $this->_aForm = array('form_attrs' => array('id' => 'text_data', 'name' => 'text_data', 'action' => bx_html_attribute($_SERVER['PHP_SELF']), 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => '', 'key' => 'id', 'uri' => 'uri', 'uri_title' => 'caption', 'submit_name' => 'post')), 'inputs' => array('author_id' => array('type' => 'hidden', 'name' => 'author_id', 'value' => $this->_iOwnerId, 'db' => array('pass' => 'Int')), 'caption' => array('type' => 'text', 'name' => 'caption', 'caption' => _t("_td_caption"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 64), 'error' => _t('_td_err_incorrect_length')), 'db' => array('pass' => 'Xss')), 'snippet' => array('type' => 'textarea', 'html' => 0, 'name' => 'snippet', 'caption' => _t("_td_snippet"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 200), 'error' => _t('_td_err_incorrect_length')), 'db' => array('pass' => 'Xss')), 'content' => array('type' => 'textarea', 'html' => 2, 'name' => 'content', 'caption' => _t("_td_content"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 65536), 'error' => _t('_td_err_incorrect_length')), 'db' => array('pass' => 'XssHtml')), 'when' => array('type' => 'datetime', 'name' => 'when', 'caption' => _t("_td_date"), 'value' => date('Y-m-d H:i'), 'required' => 1, 'checker' => array('func' => 'DateTime', 'error' => _t('_td_err_empty_value')), 'db' => array('pass' => 'DateTime')), 'tags' => array('type' => 'text', 'name' => 'tags', 'caption' => _t("_td_tags"), 'value' => '', 'required' => 1, 'checker' => array('func' => 'length', 'params' => array(3, 64), 'error' => _t('_td_err_incorrect_length')), 'info' => _t('_sys_tags_note'), 'db' => array('pass' => 'Xss')), 'categories' => $oCategories->getGroupChooser($this->_oModule->_oConfig->getCategoriesSystemName(), $this->_iOwnerId, true), 'allow_comment_to' => array(), 'allow_vote_to' => array(), 'post' => array('type' => 'submit', 'name' => 'post', 'value' => _t("_td_post")))); if (!empty($this->_iOwnerId)) { $oPrivacy = new BxDolPrivacy(); $sModuleUri = $this->_oModule->_oConfig->getUri(); $this->_aForm['inputs']['allow_comment_to'] = $oPrivacy->getGroupChooser($this->_iOwnerId, $sModuleUri, 'comment'); $this->_aForm['inputs']['allow_vote_to'] = $oPrivacy->getGroupChooser($this->_iOwnerId, $sModuleUri, 'vote'); } }
function BxBaseAlbumForm($sType, $iAlbum = 0) { $this->iOwnerId = (int) $_COOKIE['memberID']; if ($this->iOwnerId == 0) { return; } $this->iAlbumId = (int) $iAlbum; $this->sType = strip_tags($sType); $oPrivacy = new BxDolPrivacy('sys_albums', 'ID', 'Owner'); $aPrivField = $oPrivacy->getGroupChooser($this->iOwnerId, 'sys_albums', 'view'); $this->aForm = array('form_attrs' => array('name' => 'form_album', 'action' => '', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'params' => array('db' => array('table' => 'sys_albums', 'key' => 'ID', 'uri' => 'Uri', 'uri_title' => 'Caption', 'submit_name' => 'save')), 'inputs' => array('Caption' => array('type' => 'text', 'name' => 'Caption', 'caption' => _t('_sys_album_caption_capt'), 'required' => true, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_sys_album_err_capt')), 'db' => array('pass' => 'Xss'), 'display' => true), 'Location' => array('type' => 'text', 'name' => 'Location', 'caption' => _t('_sys_album_caption_loc'), 'db' => array('pass' => 'Xss'), 'display' => true), 'Description' => array('type' => 'textarea', 'name' => 'Description', 'caption' => _t('_sys_album_caption_desc'), 'required' => true, 'html' => false, 'checker' => array('func' => 'length', 'params' => array(3, 255), 'error' => _t('_sys_album_err_desc')), 'db' => array('pass' => 'Xss')), 'allow_view_to' => $aPrivField, 'Type' => array('type' => 'hidden', 'name' => 'Type', 'db' => array('pass' => 'Xss'), 'value' => $this->sType), 'Control' => array('type' => 'input_set', 0 => array('type' => 'submit', 'name' => 'save', 'value' => _t("_sys_album_create")), 1 => array('type' => 'reset', 'name' => 'cancel', 'value' => _t("_sys_album_cancel"))))); $iAlbum = (int) $iAlbum; if ($this->iAlbumId > 0) { $oAlbum = new BxDolAlbums($this->sType); $this->aInfo = $oAlbum->getAlbumInfo(array('fileId' => $iAlbum)); if ($this->iOwnerId != $this->aInfo['Owner']) { return; } $this->aForm['inputs']['Control'] = array('type' => 'input_set', 'colspan' => true, 0 => array('type' => 'submit', 'name' => 'save', 'value' => _t("_sys_album_save_changes")), 1 => array('type' => 'submit', 'name' => 'delete', 'value' => _t("_sys_album_delete")), 2 => array('type' => 'submit', 'name' => 'launch', 'value' => _t("_sys_album_add")), 3 => array('type' => 'submit', 'name' => 'launch', 'value' => _t("_sys_album_edit_items")), 4 => array('type' => 'submit', 'name' => 'launch', 'value' => _t("_sys_album_organize")), 5 => array('type' => 'reset', 'name' => 'cancel', 'value' => _t("_sys_album_cancel"))); foreach ($this->aForm['inputs'] as $sKey => $aValue) { if ($sKey != 'Control') { $this->aForm['inputs'][$sKey]['value'] = $this->aInfo[$sKey]; } } } }
public function __construct($aInfo, $oTemplate = false) { parent::__construct($aInfo, $oTemplate); $CNF =& $this->_oModule->_oConfig->CNF; if (isset($this->aInputs[$CNF['FIELD_TEXT']])) { $this->aInputs[$CNF['FIELD_TEXT']]['attrs'] = array_merge(array('id' => $CNF['FIELD_TEXT_ID']), is_array($this->aInputs[$CNF['FIELD_TEXT']]['attrs']) ? $this->aInputs[$CNF['FIELD_TEXT']]['attrs'] : array()); } if (isset($this->aInputs[$CNF['FIELD_PHOTO']])) { $this->aInputs[$CNF['FIELD_PHOTO']]['storage_object'] = $CNF['OBJECT_STORAGE']; $this->aInputs[$CNF['FIELD_PHOTO']]['uploaders'] = array('sys_simple', 'sys_html5'); $this->aInputs[$CNF['FIELD_PHOTO']]['images_transcoder'] = $CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']; $this->aInputs[$CNF['FIELD_PHOTO']]['multiple'] = true; $this->aInputs[$CNF['FIELD_PHOTO']]['content_id'] = 0; $this->aInputs[$CNF['FIELD_PHOTO']]['ghost_template'] = ''; } if (isset($this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']])) { bx_import('BxDolPrivacy'); $this->aInputs[$CNF['FIELD_ALLOW_VIEW_TO']] = BxDolPrivacy::getGroupChooser($CNF['OBJECT_PRIVACY_VIEW']); } }
check_logged(); if (!isLogged()) { login_form(); exit; } $iId = getLoggedId(); $oPrivacyView = new BxTemplPrivacyView($iId); if (isset($_POST['ps_action']) && $_POST['ps_action'] == 'get_chooser' && $iId != 0) { $sPageName = (int) $_POST['ps_page_name']; $iProfileId = (int) $_POST['ps_profile_id']; $iBlockId = (int) $_POST['ps_block_id']; $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id'); $sCode = ""; $iMemberId = getLoggedId(); if ($iMemberId == $iProfileId) { $aSelect = $oPrivacy->getGroupChooser($iMemberId, $sPageName, 'view_block'); $iCurGroupId = (int) $GLOBALS['MySQL']->getOne("SELECT `allow_view_block_to` FROM `sys_page_compose_privacy` WHERE `user_id`='" . $iMemberId . "' AND `block_id`='" . $iBlockId . "' LIMIT 1"); if ($iCurGroupId == 0) { $iCurGroupId = (int) $aSelect['value']; } $aItems = array(); foreach ($aSelect['values'] as $aValue) { if ($aValue['key'] == $iCurGroupId) { $sAlt = $aValue['value']; } $aItems[] = array('block_id' => $iBlockId, 'group_id' => $aValue['key'], 'class' => $aValue['key'] == $iCurGroupId ? 'dbPrivacyGroupActive' : 'dbPrivacyGroup', 'title' => $aValue['value']); } $sCode = $GLOBALS['oSysTemplate']->parseHtmlByName('ps_page_menu.html', array('bx_repeat:items' => $aItems)); $sCode = PopupBox('dbPrivacyMenu' . $iBlockId, _t('_ps_bcpt_block_privacy'), $sCode); } header('Content-Type:text/javascript; charset=utf-8');
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(); }
function getBlockCode_Privacy() { $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id'); $this->aFormPrivacy = array('form_attrs' => array('id' => 'profile_edit_privacy', 'name' => 'profile_edit_privacy', '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_privacy')), 'inputs' => array('profile_id' => array('type' => 'hidden', 'name' => 'profile_id', 'value' => $this->iProfileID), 'allow_view_to' => $oPrivacy->getGroupChooser(getLoggedId(), 'profile', 'view'), 'save_privacy' => array('type' => 'submit', 'name' => 'save_privacy', 'value' => _t('_edit_profile_privacy_save')))); $aProfileInfo = getProfileInfo($this->iProfileID); $this->aFormPrivacy['inputs']['allow_view_to']['value'] = $aProfileInfo['allow_view_to']; $oForm = new BxTemplFormView($this->aFormPrivacy); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { $iProfileId = (int) $_POST['profile_id']; $iAllowViewTo = (int) $_POST['allow_view_to']; $aProfileInfo = getProfileInfo($iProfileId); if ((int) db_res("UPDATE `Profiles` SET `allow_view_to`='" . $iAllowViewTo . "' WHERE `ID`='" . $iProfileId . "' LIMIT 1") > 0) { $sStatusText = '_Save profile successful'; createUserDataFile($iProfileId); if (BxDolModule::getInstance('BxWmapModule')) { BxDolService::call('wmap', 'response_entry_change', array('profiles', $iProfileId)); } // create system event bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('profile', 'edit', $iProfileId, 0, array('OldProfileInfo' => $aProfileInfo, 'privacy' => $iAllowViewTo)); $oZ->alert(); } } if ($sStatusText) { $sStatusText = MsgBox(_t($sStatusText), 3); } return array($sStatusText . $oForm->getCode(), array(), array(), false); }
protected function _getFormObject($sAction, $iId) { $oForm = parent::_getFormObject($sAction, $iId); $sPrivacyObject = 'comments_view'; $sFieldName = BxDolPrivacy::getFieldName($sPrivacyObject); $aFieldDescriptor = BxDolPrivacy::getGroupChooser($sPrivacyObject); $aFieldDescriptor['caption'] = ''; $oForm->aInputs = bx_array_insert_after(array($sFieldName => $aFieldDescriptor), $oForm->aInputs, 'cmt_text'); return $oForm; }