/** * @param string|null $sKeyPrefix */ public static function ResetCustomConfig($sKeyPrefix = null) { $sPrefix = self::CUSTOM_CONFIG_PREFIX . $sKeyPrefix; // удаляем настройки конфига из базы E::ModuleAdmin()->DelCustomConfig($sPrefix); // удаляем кеш-файл self::_deleteCustomCfg(); // перестраиваем конфиг в кеш-файле self::ReReadCustomConfig(); }
public function EventAjaxUserAdd() { E::ModuleViewer()->SetResponseAjax('json'); if ($this->IsPost()) { Config::Set('module.user.captcha_use_registration', false); $oUser = E::GetEntity('ModuleUser_EntityUser'); $oUser->_setValidateScenario('registration'); // * Заполняем поля (данные) $oUser->setLogin($this->GetPost('user_login')); $oUser->setMail($this->GetPost('user_mail')); $oUser->setPassword($this->GetPost('user_password')); $oUser->setPasswordConfirm($this->GetPost('user_password')); $oUser->setDateRegister(F::Now()); $oUser->setIpRegister(''); $oUser->setActivate(1); if ($oUser->_Validate()) { E::ModuleHook()->Run('registration_validate_after', array('oUser' => $oUser)); $oUser->setPassword($oUser->getPassword(), true); if (E::ModuleUser()->Add($oUser)) { E::ModuleHook()->Run('registration_after', array('oUser' => $oUser)); // Подписываем пользователя на дефолтные события в ленте активности E::ModuleStream()->SwitchUserEventDefaultTypes($oUser->getId()); if ($this->IsPost('user_setadmin')) { E::ModuleAdmin()->SetAdministrator($oUser->GetId()); } } E::ModuleMessage()->AddNoticeSingle(E::ModuleLang()->Get('registration_ok')); } else { E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('error')); E::ModuleViewer()->AssignAjax('aErrors', $oUser->_getValidateErrors()); } } else { E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error')); } }
/** * @param string $sPrefix * @param string|null $sConfigKey */ protected static function _resetConfig($sPrefix, $sConfigKey = null) { if ($sPrefix && substr($sPrefix, -1) != '.') { $sPrefix .= '.'; } $sPrefix = $sPrefix . $sConfigKey; // удаляем настройки конфига из базы E::ModuleAdmin()->DeleteStorageConfig($sPrefix); // удаляем кеш-файл self::_deleteFileCfg(); // перестраиваем конфиг в кеш-файле self::_reReadConfig(); }