/**
  * Saves the form
  * 
  * @return boolean
  */
 public function save()
 {
     $settingsManager = Yii::$app->settings;
     $settingsManager->set('cache.class', $this->type);
     $settingsManager->set('cache.expireTime', $this->expireTime);
     \humhub\libs\DynamicConfig::rewrite();
     return true;
 }
 /**
  * Saves the form
  * 
  * @return boolean
  */
 public function save()
 {
     $settingsManager = Yii::$app->settings;
     $settingsManager->set('mailer.transportType', $this->transportType);
     $settingsManager->set('mailer.hostname', $this->hostname);
     $settingsManager->set('mailer.username', $this->username);
     if ($this->password != '---invisible---') {
         $settingsManager->set('mailer.password', $this->password);
     }
     $settingsManager->set('mailer.port', $this->port);
     $settingsManager->set('mailer.encryption', $this->encryption);
     $settingsManager->set('mailer.allowSelfSignedCerts', $this->allowSelfSignedCerts);
     $settingsManager->set('mailer.systemEmailAddress', $this->systemEmailAddress);
     $settingsManager->set('mailer.systemEmailName', $this->systemEmailName);
     \humhub\libs\DynamicConfig::rewrite();
     return true;
 }
Example #3
0
 public function afterDelete()
 {
     parent::afterDelete();
     DynamicConfig::onSettingChange($this);
 }
 /**
  * Saves the form
  * 
  * @return boolean
  */
 public function save()
 {
     $settingsManager = Yii::$app->settings;
     $settingsManager->set('theme', $this->theme);
     $settingsManager->set('paginationSize', $this->paginationSize);
     $settingsManager->set('displayNameFormat', $this->displayName);
     Yii::$app->getModule('space')->settings->set('spaceOrder', $this->spaceOrder);
     Yii::$app->getModule('admin')->settings->set('defaultDateInputFormat', $this->dateInputDisplayFormat);
     if ($this->logo) {
         $logoImage = new \humhub\libs\LogoImage();
         $logoImage->setNew($this->logo);
     }
     \humhub\libs\DynamicConfig::rewrite();
     return true;
 }
Example #5
0
 /**
  * Sets application database in installed state
  */
 public function setDatabaseInstalled()
 {
     $config = \humhub\libs\DynamicConfig::load();
     $config['params']['databaseInstalled'] = true;
     \humhub\libs\DynamicConfig::save($config);
 }
 /**
  * E-Mail Mailing Settings
  */
 public function actionDesign()
 {
     $form = new \humhub\modules\admin\models\forms\DesignSettingsForm();
     $form->theme = Setting::Get('theme');
     $form->paginationSize = Setting::Get('paginationSize');
     $form->displayName = Setting::Get('displayNameFormat');
     $form->spaceOrder = Setting::Get('spaceOrder', 'space');
     if ($form->load(Yii::$app->request->post())) {
         $files = \yii\web\UploadedFile::getInstancesByName('logo');
         if (count($files) != 0) {
             $file = $files[0];
             $form->logo = $file;
         }
         if ($form->validate()) {
             Setting::Set('theme', $form->theme);
             Setting::Set('paginationSize', $form->paginationSize);
             Setting::Set('displayNameFormat', $form->displayName);
             Setting::Set('spaceOrder', $form->spaceOrder, 'space');
             if ($form->logo) {
                 $logoImage = new \humhub\libs\LogoImage();
                 $logoImage->setNew($form->logo);
             }
             // read and save colors from current theme
             \humhub\components\Theme::setColorVariables($form->theme);
             DynamicConfig::rewrite();
             Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
             Yii::$app->response->redirect(Url::toRoute('/admin/setting/design'));
         }
     }
     $themes = [];
     foreach (\humhub\components\Theme::getThemes() as $theme) {
         $themes[$theme->name] = $theme->name;
     }
     return $this->render('design', array('model' => $form, 'themes' => $themes, 'logo' => new \humhub\libs\LogoImage()));
 }
Example #7
0
 /**
  * The init action imports the database structure & inital data
  */
 public function actionInit()
 {
     if (!$this->module->checkDBConnection()) {
         return $this->redirect(['/installer/setup/database']);
     }
     // Flush Caches
     Yii::$app->cache->flush();
     // Disable max execution time to avoid timeouts during database installation
     @ini_set('max_execution_time', 0);
     // Migrate Up Database
     $result = \humhub\commands\MigrateController::webMigrateAll();
     DynamicConfig::rewrite();
     $this->module->setDatabaseInstalled();
     return $this->redirect(['/installer/config/index']);
 }
 public function actionFinish()
 {
     if (Yii::$app->settings->get('secret') == "") {
         Yii::$app->settings->set('secret', \humhub\libs\UUID::v4());
     }
     \humhub\libs\DynamicConfig::rewrite();
     return $this->redirect(['finished']);
 }
Example #9
0
 /**
  * Returns a text entry from the registry table
  *
  * @param type $name
  * @param type $moduleId
  * @return type
  */
 public static function GetText($name, $moduleId = "")
 {
     if (DynamicConfig::getSettingValue($name, $moduleId) !== null) {
         return DynamicConfig::getSettingValue($name, $moduleId);
     }
     $record = self::GetRecord($name, $moduleId);
     return $record->value_text;
 }
Example #10
0
 public function actionFinish()
 {
     if (Setting::Get('secret') == "") {
         Setting::Set('secret', \humhub\libs\UUID::v4());
     }
     \humhub\libs\DynamicConfig::rewrite();
     $this->redirect(['finished']);
 }
 /**
  * Saves the form
  *
  * @return boolean
  */
 public function save()
 {
     Yii::$app->settings->set('name', $this->name);
     Yii::$app->settings->set('baseUrl', $this->baseUrl);
     Yii::$app->settings->set('defaultLanguage', $this->defaultLanguage);
     Yii::$app->settings->set('timeZone', $this->timeZone);
     Yii::$app->getModule('dashboard')->settings->set('showProfilePostForm', $this->dashboardShowProfilePostForm);
     Yii::$app->getModule('tour')->settings->set('enable', $this->tour);
     Yii::$app->getModule('friendship')->settings->set('enable', $this->enableFriendshipModule);
     Yii::$app->getModule('content')->settings->set('stream.defaultSort', $this->defaultStreamSort);
     $spaceGuids = explode(",", $this->defaultSpaceGuid);
     // Remove Old Default Spaces
     foreach (Space::findAll(['auto_add_new_members' => 1]) as $space) {
         if (!in_array($space->guid, $spaceGuids)) {
             $space->auto_add_new_members = 0;
             $space->save();
         }
     }
     // Add new Default Spaces
     foreach ($spaceGuids as $spaceGuid) {
         $space = Space::findOne(['guid' => $spaceGuid]);
         if ($space != null && $space->auto_add_new_members != 1) {
             $space->auto_add_new_members = 1;
             $space->save();
         }
     }
     DynamicConfig::rewrite();
     return true;
 }