public function testTextSettings() { $longText = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."; Setting::SetText('longText', $longText); Setting::SetText('longText', $longText . "2", 'testModule'); $this->assertEquals(Setting::GetText('longText'), $longText); $this->assertEquals(Setting::GetText('longText', 'testModule'), $longText . "2"); }
public function up() { $allowedExtensions = Setting::Get('allowedExtensions', 'embeddedmedia'); if ($allowedExtensions != "") { Setting::Set('allowedExtensions', '', 'embeddedmedia'); Setting::SetText('allowedExtensions', $allowedExtensions, 'embeddedmedia'); } $showFilesWidgetBlacklist = Setting::Get('showFilesWidgetBlacklist', 'embeddedmedia'); if ($showFilesWidgetBlacklist != "") { Setting::Set('showFilesWidgetBlacklist', '', 'embeddedmedia'); Setting::SetText('showFilesWidgetBlacklist', $showFilesWidgetBlacklist, 'embeddedmedia'); } }
/** * Configuration Action for Super Admins */ public function actionIndex() { $form = new AnonAccountsForm(); if (isset($_POST['AnonAccountsForm'])) { $form->attributes = $_POST['AnonAccountsForm']; if ($form->validate()) { $form->anonAccountsFirstNameOptions = Setting::SetText('anonAccountsFirstNameOptions', $form->anonAccountsFirstNameOptions); $form->anonAccountsLastNameOptions = Setting::SetText('anonAccountsLastNameOptions', $form->anonAccountsLastNameOptions); // set flash message Yii::$app->getSession()->setFlash('data-saved', 'Saved'); return $this->redirect(Url::toRoute('index')); } } else { $form->anonAccountsFirstNameOptions = Setting::GetText('anonAccountsFirstNameOptions'); $form->anonAccountsLastNameOptions = Setting::GetText('anonAccountsLastNameOptions'); } return $this->render('index', array('model' => $form)); }
/** * Configuration Action for Super Admins */ public function actionIndex() { $form = new EditForm(); $form->title = Setting::Get('title', 'breakingnews'); $form->message = Setting::GetText('message', 'breakingnews'); $form->active = Setting::Get('active', 'breakingnews'); if ($form->load(Yii::$app->request->post()) && $form->validate()) { Setting::Set('title', $form->title, 'breakingnews'); Setting::SetText('message', $form->message, 'breakingnews'); if ($form->active) { Setting::Set('active', true, 'breakingnews'); } else { Setting::Set('active', false, 'breakingnews'); } if ($form->reset) { foreach (\humhub\modules\user\models\Setting::findAll(array('name' => 'seen', 'module_id' => 'breakingnews')) as $userSetting) { $userSetting->delete(); } } return $this->redirect(Url::to(['/breakingnews/admin/index'])); } return $this->render('index', ['model' => $form]); }
/** * File Settings */ public function actionFile() { $form = new \humhub\modules\admin\models\forms\FileSettingsForm(); $form->imageMagickPath = Setting::Get('imageMagickPath', 'file'); $form->maxFileSize = Setting::Get('maxFileSize', 'file') / 1024 / 1024; $form->maxPreviewImageWidth = Setting::Get('maxPreviewImageWidth', 'file'); $form->maxPreviewImageHeight = Setting::Get('maxPreviewImageHeight', 'file'); $form->hideImageFileInfo = Setting::Get('hideImageFileInfo', 'file'); $form->useXSendfile = Setting::Get('useXSendfile', 'file'); $form->allowedExtensions = Setting::GetText('allowedExtensions', 'file'); $form->showFilesWidgetBlacklist = Setting::GetText('showFilesWidgetBlacklist', 'file'); if ($form->load(Yii::$app->request->post()) && $form->validate()) { $new = $form->maxFileSize * 1024 * 1024; Setting::Set('imageMagickPath', $form->imageMagickPath, 'file'); Setting::Set('maxFileSize', $new, 'file'); Setting::Set('maxPreviewImageWidth', $form->maxPreviewImageWidth, 'file'); Setting::Set('maxPreviewImageHeight', $form->maxPreviewImageHeight, 'file'); Setting::Set('hideImageFileInfo', $form->hideImageFileInfo, 'file'); Setting::Set('useXSendfile', $form->useXSendfile, 'file'); Setting::SetText('allowedExtensions', strtolower($form->allowedExtensions), 'file'); Setting::SetText('showFilesWidgetBlacklist', $form->showFilesWidgetBlacklist, 'file'); // set flash message Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved')); return Yii::$app->response->redirect(Url::toRoute('/admin/setting/file')); } // Determine PHP Upload Max FileSize $maxUploadSize = \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('upload_max_filesize')); if ($maxUploadSize > \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'))) { $maxUploadSize = \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size')); } $maxUploadSize = floor($maxUploadSize / 1024 / 1024); // Determine currently used ImageLibary $currentImageLibary = 'GD'; if (Setting::Get('imageMagickPath', 'file')) { $currentImageLibary = 'ImageMagick'; } return $this->render('file', array('model' => $form, 'maxUploadSize' => $maxUploadSize, 'currentImageLibary' => $currentImageLibary)); }
/** * Saves an array of available OEmbed providers * * @param array $providers */ public static function setProviders($providers) { Setting::SetText('oembedProviders', \yii\helpers\Json::encode($providers)); }