public function up()
 {
     $this->dropTable(UserChatMessage::tableName());
     $this->createTable(UserChatMessage::tableName(), ['id' => $this->primaryKey(), 'message' => $this->text()->notNull(), 'created_at' => $this->dateTime()->notNull(), 'created_by' => $this->integer()->notNull()]);
     Setting::Set('theme', 'theme_bright.css', 'humhubchat');
     Setting::Set('timeout', '1', 'humhubchat');
 }
 /**
  * Configuration Action for Super Admins.
  */
 public function actionIndex()
 {
     $post = $this->getPost(array('SmsProviderConfigureForm', 'AnySmsConfigureForm', 'ClickatellConfigureForm', 'SpryngConfigureForm'));
     if ($post != null) {
         $provider = $post['provider'];
         $form = $this->getSmsProviderForm($provider);
         // provider changed => just change the provider setting and reload the correct form
         if ($provider != Setting::Get('provider', 'sms')) {
             $form = new \humhub\modules\sms\forms\SmsProviderConfigureForm();
         } else {
             $form = $this->getSmsProviderForm($provider);
         }
         $form->setAttributes($post);
         if ($form->validate()) {
             foreach ($form->attributeNames() as $attributeName) {
                 Setting::Set($attributeName, $form->{$attributeName}, 'sms');
             }
             return $this->redirect(['/sms/config']);
         }
     } else {
         $provider = Setting::Get('provider', 'sms');
         $form = $this->getSmsProviderForm($provider);
         foreach ($form->attributeNames() as $attributeName) {
             $form->{$attributeName} = Setting::Get($attributeName, 'sms');
         }
     }
     return $this->render('index', array('model' => $form));
 }
Ejemplo n.º 3
0
 /**
  * Check if there is a new Humhub Version available and sends a notification
  * to super admins
  *
  * @param \yii\base\Event $event
  */
 public static function onCronDailyRun($event)
 {
     $controller = $event->sender;
     if (!Yii::$app->getModule('admin')->dailyCheckForNewVersion) {
         return;
     }
     if (!Yii::$app->params['humhub']['apiEnabled']) {
         return;
     }
     $controller->stdout("Checking for new HumHub version... ");
     $latestVersion = libs\HumHubAPI::getLatestHumHubVersion();
     if ($latestVersion != "") {
         $adminUserQuery = User::find()->where(['super_admin' => 1]);
         $latestNotifiedVersion = Setting::Get('lastVersionNotify', 'admin');
         $adminsNotified = !($latestNotifiedVersion == "" || version_compare($latestVersion, $latestNotifiedVersion, ">"));
         $newVersionAvailable = version_compare($latestVersion, Yii::$app->version, ">");
         $updateNotification = new notifications\NewVersionAvailable();
         // Cleanup existing notifications
         if (!$newVersionAvailable || $newVersionAvailable && !$adminsNotified) {
             foreach ($adminUserQuery->all() as $admin) {
                 $updateNotification->delete($admin);
             }
         }
         // Create new notification
         if ($newVersionAvailable && !$adminsNotified) {
             $updateNotification->sendBulk($adminUserQuery);
             Setting::Set('lastVersionNotify', $latestVersion, 'admin');
         }
     }
     $controller->stdout('done. ' . PHP_EOL, \yii\helpers\Console::FG_GREEN);
 }
Ejemplo n.º 4
0
 public function actionAuto()
 {
     $this->stdout("Install:\n\n", Console::FG_YELLOW);
     \humhub\modules\installer\libs\InitialData::bootstrap();
     Setting::Set('name', "HumHub Test");
     Setting::Set('systemEmailName', "*****@*****.**", 'mailing');
     Setting::Set('systemEmailName', "*****@*****.**", 'mailing');
     Setting::Set('secret', \humhub\libs\UUID::v4());
     $user = new User();
     $user->group_id = 1;
     $user->username = "******";
     $user->auth_mode = 'local';
     $user->email = '*****@*****.**';
     $user->status = User::STATUS_ENABLED;
     $user->language = '';
     $user->last_activity_email = new \yii\db\Expression('NOW()');
     if (!$user->save()) {
         throw new \yii\base\Exception("Could not save user");
     }
     $user->profile->title = "System Administration";
     $user->profile->firstname = "John";
     $user->profile->lastname = "Doe";
     $user->profile->save();
     $password = new Password();
     $password->user_id = $user->id;
     $password->setPassword('test');
     $password->save();
     return self::EXIT_CODE_NORMAL;
 }
Ejemplo n.º 5
0
 /**
  * Executes daily cron tasks.
  */
 public function actionDaily()
 {
     $this->stdout("Executing daily tasks:\n\n", Console::FG_YELLOW);
     $this->trigger(self::EVENT_ON_DAILY_RUN);
     $this->stdout("\n\nAll cron tasks finished.\n\n", Console::FG_GREEN);
     Setting::Set('cronLastDailyRun', time());
     return self::EXIT_CODE_NORMAL;
 }
Ejemplo n.º 6
0
 /**
  * Enables this module
  */
 public function enable()
 {
     if (!Yii::$app->hasModule('mostactiveusers')) {
         // set default config values
         Setting::Set('noUsers', 5, 'mostactiveusers');
     }
     parent::enable();
 }
 /**
  * Configuration action for super admins.
  */
 public function actionIndex()
 {
     $form = new ConfigureForm();
     $form->disableZipSupport = Setting::Get('disableZipSupport', 'cfiles');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         Setting::Set('disableZipSupport', $form->disableZipSupport, 'cfiles');
     }
     return $this->render('index', array('model' => $form));
 }
 public function actionIndex()
 {
     $form = new ModuleConfigForm();
     $form->apiKey = Setting::Get('apiKey', 'dropbox');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         Setting::Set('apiKey', $form->apiKey, 'dropbox');
     }
     return $this->render('index', array('model' => $form));
 }
 /**
  * Configuration Action for Super Admins
  */
 public function actionConfig()
 {
     $form = new ConfigureForm();
     $form->noUsers = Setting::Get('noUsers', 'mostactiveusers');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         $form->noUsers = Setting::Set('noUsers', $form->noUsers, 'mostactiveusers');
         return $this->redirect(['/mostactiveusers/config/config']);
     }
     return $this->render('config', array('model' => $form));
 }
 /**
  * Configuration Action for Super Admins
  */
 public function actionIndex()
 {
     $form = new \humhub\modules\birthday\models\BirthdayConfigureForm();
     $form->shownDays = Setting::Get('shownDays', 'birthday');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         $form->shownDays = Setting::Set('shownDays', $form->shownDays, 'birthday');
         return $this->redirect(['/birthday/config']);
     }
     return $this->render('index', array('model' => $form));
 }
 public function actionIndex()
 {
     $form = new ConfigureForm();
     $form->baseUrl = Setting::Get('baseUrl', 'notes');
     $form->apiKey = Setting::Get('apiKey', 'notes');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         $form->baseUrl = Setting::Set('baseUrl', $form->baseUrl, 'notes');
         $form->apiKey = Setting::Set('apiKey', $form->apiKey, 'notes');
         return $this->redirect(['/notes/config']);
     }
     return $this->render('index', array('model' => $form));
 }
 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');
     }
 }
Ejemplo n.º 13
0
 /**
  * General Space Settings
  */
 public function actionSettings()
 {
     $form = new \humhub\modules\admin\models\forms\SpaceSettingsForm();
     $form->defaultJoinPolicy = Setting::Get('defaultJoinPolicy', 'space');
     $form->defaultVisibility = Setting::Get('defaultVisibility', 'space');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         Setting::Set('defaultJoinPolicy', $form->defaultJoinPolicy, 'space');
         Setting::Set('defaultVisibility', $form->defaultVisibility, 'space');
         // set flash message
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SpaceController', 'Saved'));
         $this->redirect(Url::toRoute('settings'));
     }
     return $this->render('settings', array('model' => $form));
 }
Ejemplo n.º 14
0
 /**
  * Configuration Action for Super Admins
  */
 public function actionConfig()
 {
     $form = new ConfigureForm();
     $form->gcmAPIKey = Setting::Get('gcmAPIKey', 'gcm');
     //$form->gcmURL = Setting::Get('gcmURL', 'gcm');
     if (!($form->gcmURL = Setting::Get('gcmURL', 'gcm'))) {
         $form->gcmURL = 'https://android.googleapis.com/gcm/send';
     }
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         $form->gcmAPIKey = Setting::Set('gcmAPIKey', $form->gcmAPIKey, 'gcm');
         $form->gcmURL = Setting::Set('gcmURL', $form->gcmURL, 'gcm');
         return $this->redirect(['/gcm/config/config']);
     }
     return $this->render('config', array('model' => $form));
 }
 public function actionIndex()
 {
     $form = new \humhub\modules\humhubchat\forms\SettingsForm();
     if ($form->load(Yii::$app->request->post())) {
         if ($form->validate()) {
             Setting::Set('theme', $form->theme, 'humhubchat');
             Setting::Set('timeout', $form->timeout, 'humhubchat');
             Yii::$app->session->setFlash('data-saved', Yii::t('Humhub-chatModule.base', 'Saved'));
             // $this->redirect(Url::toRoute('index'));
         }
     } else {
         $form->theme = Setting::Get('theme', 'humhubchat');
         $form->timeout = Setting::Get('timeout', 'humhubchat');
     }
     return $this->render('index', ['model' => $form]);
 }
Ejemplo n.º 16
0
 public function testSetGet()
 {
     $this->assertTrue(Setting::Get('theme') == 'HumHub');
     // Without Module
     $this->assertTrue(Setting::Get('theme') == 'HumHub');
     Setting::Set('theme', 'HumHub2');
     $this->assertTrue(Setting::Get('theme') == 'HumHub2');
     $this->assertTrue(Setting::Get('theme', '') == 'HumHub2');
     // Module
     $this->assertFalse(Setting::Get('expireTime') == '3600');
     $this->assertTrue(Setting::Get('expireTime', 'cache') == '3600');
     Setting::Set('expireTime', '3601', 'cache');
     $this->assertTrue(Setting::Get('expireTime', 'cache') == '3601');
     // Create
     Setting::Set('newSetting', 'newValue');
     $this->assertTrue(Setting::Get('newSetting') == 'newValue');
     Setting::Set('newSetting', 'newValue2', 'someModuleId');
     $this->assertTrue(Setting::Get('newSetting', 'someModuleId') == 'newValue2');
 }
 /**
  * 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]);
 }
Ejemplo n.º 18
0
 /**
  * Last Step, finish up the installation
  */
 public function actionFinished()
 {
     // Should not happen
     if (Setting::Get('secret') == "") {
         throw new CException("Finished without secret setting!");
     }
     Setting::Set('timeZone', Yii::$app->timeZone);
     // Set to installed
     $this->module->setInstalled();
     try {
         Yii::$app->user->logout();
     } catch (Exception $e) {
     }
     return $this->render('finished');
 }
Ejemplo n.º 19
0
 /**
  * Proxy Settings
  */
 public function actionProxy()
 {
     $form = new \humhub\modules\admin\models\forms\ProxySettingsForm();
     $form->enabled = Setting::Get('enabled', 'proxy');
     $form->server = Setting::Get('server', 'proxy');
     $form->port = Setting::Get('port', 'proxy');
     $form->user = Setting::Get('user', 'proxy');
     $form->password = Setting::Get('password', 'proxy');
     $form->noproxy = Setting::Get('noproxy', 'proxy');
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
         Setting::Set('enabled', $form->enabled, 'proxy');
         Setting::Set('server', $form->server, 'proxy');
         Setting::Set('port', $form->port, 'proxy');
         Setting::Set('user', $form->user, 'proxy');
         Setting::Set('password', $form->password, 'proxy');
         Setting::Set('noproxy', $form->noproxy, 'proxy');
         // set flash message
         Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_ProxyController', 'Saved'));
         return Yii::$app->response->redirect(Url::toRoute('/admin/setting/proxy'));
     }
     return $this->render('proxy', array('model' => $form));
 }
 public static function setColorVariables($themeName)
 {
     $theme = self::getThemeByName($themeName);
     if ($theme === null) {
         return;
     }
     $lessFileName = Yii::getAlias($theme->getBasePath() . '/css/theme.less');
     if (file_exists($lessFileName)) {
         $file = fopen($lessFileName, "r") or die("Unable to open file!");
         $less = fread($file, filesize($lessFileName));
         fclose($file);
         $startDefault = strpos($less, '@default') + 10;
         $startPrimary = strpos($less, '@primary') + 10;
         $startInfo = strpos($less, '@info') + 7;
         $startSuccess = strpos($less, '@success') + 10;
         $startWarning = strpos($less, '@warning') + 10;
         $startDanger = strpos($less, '@danger') + 9;
         $length = 7;
         Setting::Set('colorDefault', substr($less, $startDefault, $length));
         Setting::Set('colorPrimary', substr($less, $startPrimary, $length));
         Setting::Set('colorInfo', substr($less, $startInfo, $length));
         Setting::Set('colorSuccess', substr($less, $startSuccess, $length));
         Setting::Set('colorWarning', substr($less, $startWarning, $length));
         Setting::Set('colorDanger', substr($less, $startDanger, $length));
     }
 }
Ejemplo n.º 21
0
 public function testGroupAssignment()
 {
     $group2 = new Group();
     $group2->name = "TestGrp1";
     $group2->description = "test";
     $this->assertTrue($group2->save());
     \humhub\models\Setting::Set('defaultUserGroup', $group2->id, 'authentication_internal');
     $user = new User();
     $user->username = "******";
     $user->email = "*****@*****.**";
     $this->assertTrue($user->save());
     $this->assertEquals($user->group_id, $group2->id);
 }
Ejemplo n.º 22
0
 public static function bootstrap()
 {
     // Seems database is already initialized
     if (Setting::Get('paginationSize') == 10) {
         return;
     }
     //Yii::$app->search->rebuild();
     Setting::Set('baseUrl', \yii\helpers\BaseUrl::base(true));
     Setting::Set('paginationSize', 10);
     Setting::Set('displayNameFormat', '{profile.firstname} {profile.lastname}');
     // Authentication
     Setting::Set('authInternal', '1', 'authentication');
     Setting::Set('authLdap', '0', 'authentication');
     Setting::Set('refreshUsers', '1', 'authentication_ldap');
     Setting::Set('needApproval', '0', 'authentication_internal');
     Setting::Set('anonymousRegistration', '1', 'authentication_internal');
     Setting::Set('internalUsersCanInvite', '1', 'authentication_internal');
     // Mailing
     Setting::Set('transportType', 'php', 'mailing');
     Setting::Set('systemEmailAddress', '*****@*****.**', 'mailing');
     Setting::Set('systemEmailName', 'My Social Network', 'mailing');
     Setting::Set('receive_email_activities', User::RECEIVE_EMAIL_DAILY_SUMMARY, 'mailing');
     Setting::Set('receive_email_notifications', User::RECEIVE_EMAIL_WHEN_OFFLINE, 'mailing');
     // File
     Setting::Set('maxFileSize', '1048576', 'file');
     Setting::Set('maxPreviewImageWidth', '200', 'file');
     Setting::Set('maxPreviewImageHeight', '200', 'file');
     Setting::Set('hideImageFileInfo', '0', 'file');
     // Caching
     Setting::Set('type', 'CFileCache', 'cache');
     Setting::Set('expireTime', '3600', 'cache');
     Setting::Set('installationId', md5(uniqid("", true)), 'admin');
     // Design
     Setting::Set('theme', "HumHub");
     Setting::Set('spaceOrder', 0, 'space');
     // Basic
     Setting::Set('enable', 1, 'tour');
     Setting::Set('defaultLanguage', Yii::$app->language);
     // Notification
     Setting::Set('enable_html5_desktop_notifications', 0, 'notification');
     // Add Categories
     $cGeneral = new ProfileFieldCategory();
     $cGeneral->title = "General";
     $cGeneral->sort_order = 100;
     $cGeneral->visibility = 1;
     $cGeneral->is_system = 1;
     $cGeneral->description = '';
     if (!$cGeneral->save()) {
         throw new Exception(print_r($cGeneral->getErrors(), true));
     }
     $cCommunication = new ProfileFieldCategory();
     $cCommunication->title = "Communication";
     $cCommunication->sort_order = 200;
     $cCommunication->visibility = 1;
     $cCommunication->is_system = 1;
     $cCommunication->description = '';
     $cCommunication->save();
     $cSocial = new ProfileFieldCategory();
     $cSocial->title = "Social bookmarks";
     $cSocial->sort_order = 300;
     $cSocial->visibility = 1;
     $cSocial->is_system = 1;
     $cSocial->description = '';
     $cSocial->save();
     // Add Fields
     $field = new ProfileField();
     $field->internal_name = "firstname";
     $field->title = 'Firstname';
     $field->sort_order = 100;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->ldap_attribute = 'givenName';
     $field->is_system = 1;
     $field->required = 1;
     $field->show_at_registration = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 20;
         $field->fieldType->save();
     } else {
         throw new Exception(print_r($field->getErrors(), true));
     }
     $field = new ProfileField();
     $field->internal_name = "lastname";
     $field->title = 'Lastname';
     $field->sort_order = 200;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->ldap_attribute = 'sn';
     $field->show_at_registration = 1;
     $field->required = 1;
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 30;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "title";
     $field->title = 'Title';
     $field->sort_order = 300;
     $field->ldap_attribute = 'title';
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 50;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "gender";
     $field->title = 'Gender';
     $field->sort_order = 300;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = 'ProfileFieldTypeSelect';
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->options = "male=>Male\nfemale=>Female\ncustom=>Custom";
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "street";
     $field->title = 'Street';
     $field->sort_order = 400;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 150;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "zip";
     $field->title = 'Zip';
     $field->sort_order = 500;
     $field->profile_field_category_id = $cGeneral->id;
     $field->is_system = 1;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     if ($field->save()) {
         $field->fieldType->maxLength = 10;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "city";
     $field->title = 'City';
     $field->sort_order = 600;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "country";
     $field->title = 'Country';
     $field->sort_order = 700;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "state";
     $field->title = 'State';
     $field->sort_order = 800;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "birthday";
     $field->title = 'Birthday';
     $field->sort_order = 900;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Birthday::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "about";
     $field->title = 'About';
     $field->sort_order = 900;
     $field->profile_field_category_id = $cGeneral->id;
     $field->field_type_class = 'ProfileFieldTypeTextArea';
     $field->is_system = 1;
     if ($field->save()) {
         #$field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "phone_private";
     $field->title = 'Phone Private';
     $field->sort_order = 100;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "phone_work";
     $field->title = 'Phone Work';
     $field->sort_order = 200;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "mobile";
     $field->title = 'Mobile';
     $field->sort_order = 300;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "fax";
     $field->title = 'Fax';
     $field->sort_order = 400;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "im_skype";
     $field->title = 'Skype Nickname';
     $field->sort_order = 500;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "im_msn";
     $field->title = 'MSN';
     $field->sort_order = 600;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "im_icq";
     $field->title = 'ICQ Number';
     $field->sort_order = 700;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = 'ProfileFieldTypeNumber';
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "im_xmpp";
     $field->title = 'XMPP Jabber Address';
     $field->sort_order = 800;
     $field->profile_field_category_id = $cCommunication->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'email';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url";
     $field->title = 'Url';
     $field->sort_order = 100;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_facebook";
     $field->title = 'Facebook URL';
     $field->sort_order = 200;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_linkedin";
     $field->title = 'LinkedIn URL';
     $field->sort_order = 300;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_xing";
     $field->title = 'Xing URL';
     $field->sort_order = 400;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_youtube";
     $field->title = 'Youtube URL';
     $field->sort_order = 500;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_vimeo";
     $field->title = 'Vimeo URL';
     $field->sort_order = 600;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_flickr";
     $field->title = 'Flickr URL';
     $field->sort_order = 700;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_myspace";
     $field->title = 'MySpace URL';
     $field->sort_order = 800;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_googleplus";
     $field->title = 'Google+ URL';
     $field->sort_order = 900;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $field = new ProfileField();
     $field->internal_name = "url_twitter";
     $field->title = 'Twitter URL';
     $field->sort_order = 1000;
     $field->profile_field_category_id = $cSocial->id;
     $field->field_type_class = \humhub\modules\user\models\fieldtype\Text::className();
     $field->is_system = 1;
     if ($field->save()) {
         $field->fieldType->validator = 'url';
         $field->fieldType->save();
     }
     $group = new Group();
     $group->name = "Users";
     $group->description = "Example Group by Installer";
     $group->save();
 }
Ejemplo n.º 23
0
 public static function setColorVariables($themeName)
 {
     $url = Yii::getAlias('@webroot/themes/' . $themeName . '/css/theme.less');
     $file = fopen("{$url}", "r") or die("Unable to open file!");
     $less = fread($file, filesize("{$url}"));
     fclose($file);
     $startDefault = strpos($less, '@default') + 10;
     $startPrimary = strpos($less, '@primary') + 10;
     $startInfo = strpos($less, '@info') + 7;
     $startSuccess = strpos($less, '@success') + 10;
     $startWarning = strpos($less, '@warning') + 10;
     $startDanger = strpos($less, '@danger') + 9;
     $length = 7;
     Setting::Set('colorDefault', substr($less, $startDefault, $length));
     Setting::Set('colorPrimary', substr($less, $startPrimary, $length));
     Setting::Set('colorInfo', substr($less, $startInfo, $length));
     Setting::Set('colorSuccess', substr($less, $startSuccess, $length));
     Setting::Set('colorWarning', substr($less, $startWarning, $length));
     Setting::Set('colorDanger', substr($less, $startDanger, $length));
 }
Ejemplo n.º 24
0
 /**
  * @inheritdoc
  */
 public function enable()
 {
     parent::enable();
     Setting::Set('shownDays', 2, 'birthday');
 }