当前位置: 首页>>代码示例>>PHP>>正文


PHP HSetting::Set方法代码示例

本文整理汇总了PHP中HSetting::Set方法的典型用法代码示例。如果您正苦于以下问题:PHP HSetting::Set方法的具体用法?PHP HSetting::Set怎么用?PHP HSetting::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HSetting的用法示例。


在下文中一共展示了HSetting::Set方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 /**
  * Configuration Action for Super Admins
  */
 public function actionIndex()
 {
     Yii::import('library.forms.*');
     $form = new LibraryAdminForm();
     // uncomment the following code to enable ajax-based validation
     //if (isset($_POST['ajax']) && $_POST['ajax'] === 'LibraryAdminForm') {
     //    echo CActiveForm::validate($form);
     //    Yii::app()->end();
     //}
     if (isset($_POST['LibraryAdminForm'])) {
         $_POST['LibraryAdminForm'] = Yii::app()->input->stripClean($_POST['LibraryAdminForm']);
         $form->attributes = $_POST['LibraryAdminForm'];
         if ($form->validate()) {
             $form->globalPublicLibrary = HSetting::Set('globalPublicLibrary', $form->globalPublicLibrary, 'library');
             $form->disclaimerWidget = HSetting::Set('disclaimerWidget', $form->disclaimerWidget, 'library');
             $form->disclaimerTitle = HSetting::Set('disclaimerTitle', $form->disclaimerTitle, 'library');
             $form->disclaimerContent = HSetting::Set('disclaimerContent', $form->disclaimerContent, 'library');
             $this->redirect(Yii::app()->createUrl('library/admin/index'));
         }
     } else {
         $form->globalPublicLibrary = HSetting::Get('globalPublicLibrary', 'library');
         $form->disclaimerWidget = HSetting::Get('disclaimerWidget', 'library');
         $form->disclaimerTitle = HSetting::Get('disclaimerTitle', 'library');
         $form->disclaimerContent = HSetting::Get('disclaimerContent', 'library');
     }
     $this->render('index', array('model' => $form));
 }
开发者ID:tejrajs,项目名称:humhub-modules-library,代码行数:30,代码来源:AdminController.php

示例2: testDynamicConfig

 public function testDynamicConfig()
 {
     HSetting::Set('theme', 'HumHub2');
     $config = HSetting::getConfiguration();
     $this->assertArrayHasKey('theme', $config);
     $this->assertEquals($config['theme'], 'HumHub2');
 }
开发者ID:alefernie,项目名称:intranet,代码行数:7,代码来源:HSettingTest.php

示例3: doBaseTasks

 /**
  * Do general tasks used application whide
  */
 protected function doBaseTasks()
 {
     $this->showTestHeadline("Checking application base structure");
     if (HSetting::Get('secret') == "" || HSetting::Get('secret') == null) {
         HSetting::Set('secret', UUID::v4());
         $this->showFix('Setting missing application secret!');
     }
 }
开发者ID:skapl,项目名称:design,代码行数:11,代码来源:IntegrityChecker.php

示例4: up

 public function up()
 {
     $allowedExtensions = HSetting::Get('allowedExtensions', 'file');
     if ($allowedExtensions != "") {
         HSetting::Set('allowedExtensions', '', 'file');
         HSetting::SetText('allowedExtensions', $allowedExtensions, 'file');
     }
     $showFilesWidgetBlacklist = HSetting::Get('showFilesWidgetBlacklist', 'file');
     if ($showFilesWidgetBlacklist != "") {
         HSetting::Set('showFilesWidgetBlacklist', '', 'file');
         HSetting::SetText('showFilesWidgetBlacklist', $showFilesWidgetBlacklist, 'file');
     }
 }
开发者ID:skapl,项目名称:design,代码行数:13,代码来源:m150322_195619_allowedExt2Text.php

示例5: disable

 /**
  * Delete All Albums and settings.
  */
 public function disable()
 {
     if (parent::disable()) {
         foreach (Album::model()->findAll() as $album) {
             $album->delete();
         }
         $blacklisted_objects = explode(',', HSetting::Get('showFilesWidgetBlacklist', 'file'));
         if (false !== ($key = array_search('Album', $blacklisted_objects))) {
             unset($blacklisted_objects[$key]);
             HSetting::Set('showFilesWidgetBlacklist', implode(',', $blacklisted_objects));
         }
         HSetting::set('allowedExtensions', '', 'album');
         return true;
     }
     return false;
 }
开发者ID:rafapaul,项目名称:humhub-modules-album,代码行数:19,代码来源:AlbumModule.php

示例6: actionSettings

 public function actionSettings()
 {
     $form = new RoomsSettingsForm();
     $form->defaultJoinPolicy = HSetting::Get('defaultJoinPolicy', 'room');
     $form->defaultVisibility = HSetting::Get('defaultVisibility', 'room');
     // uncomment the following code to enable ajax-based validation
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'rooms-settings-form') {
         echo CActiveForm::validate($form);
         Yii::app()->end();
     }
     if (isset($_POST['RoomsSettingsForm'])) {
         $_POST['RoomsSettingsForm'] = Yii::app()->input->stripClean($_POST['RoomsSettingsForm']);
         $form->attributes = $_POST['RoomsSettingsForm'];
         if ($form->validate()) {
             HSetting::Set('defaultJoinPolicy', $form->defaultJoinPolicy, 'room');
             HSetting::Set('defaultVisibility', $form->defaultVisibility, 'room');
             // set flash message
             Yii::app()->user->setFlash('data-saved', Yii::t('RoomsModule.controllers_SpaceController', 'Saved'));
             $this->redirect($this->createUrl('settings'));
         }
     }
     $this->render('settings', array('model' => $form));
 }
开发者ID:verdin12345,项目名称:humhub-modules-rooms,代码行数:23,代码来源:SetController.php

示例7: actionIndex

 /**
  * Configuration Action for Super Admins
  */
 public function actionIndex()
 {
     Yii::import('yiigii.forms.*');
     $form = new ConfigureForm();
     // uncomment the following code to enable ajax-based validation
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'configure-form') {
         echo CActiveForm::validate($form);
         Yii::app()->end();
     }
     if (isset($_POST['ConfigureForm'])) {
         $_POST['ConfigureForm'] = Yii::app()->input->stripClean($_POST['ConfigureForm']);
         $form->attributes = $_POST['ConfigureForm'];
         if ($form->validate()) {
             $form->password = HSetting::Set('password', $form->password, 'yiigii');
             $form->ipFilters = HSetting::Set('ipFilters', $form->ipFilters, 'yiigii');
             $this->redirect(Yii::app()->createUrl('yiigii/config/index'));
         }
     } else {
         $form->password = HSetting::Get('password', 'yiigii');
         $form->ipFilters = HSetting::Get('ipFilters', 'yiigii');
     }
     $this->render('index', array('model' => $form));
 }
开发者ID:pkdevboxy,项目名称:humhub-modules-yiigii,代码行数:26,代码来源:ConfigController.php

示例8: actionDisable

 /**
  * Disables application cache
  */
 public function actionDisable()
 {
     HSetting::Set('type', 'CDummyCache', 'cache');
     print "Application Cache disabled!\n";
 }
开发者ID:alefernie,项目名称:intranet,代码行数:8,代码来源:HCacheCommand.php

示例9: delete

 /**
  * Deletes a user including all dependencies
  *
  * @return boolean
  */
 public function delete()
 {
     GroupAdmin::model()->deleteAllByAttributes(array('group_id' => $this->id));
     // Clear Default User Group for Registration if needed
     if (HSetting::Get('defaultUserGroup', 'authentication_internal') == $this->id) {
         HSetting::Set('defaultUserGroup', '', 'authentication_internal');
     }
     return parent::delete();
 }
开发者ID:alefernie,项目名称:intranet,代码行数:14,代码来源:Group.php

示例10: actionFile

 /**
  * File Settings
  */
 public function actionFile()
 {
     Yii::import('admin.forms.*');
     $form = new FileSettingsForm();
     $form->imageMagickPath = HSetting::Get('imageMagickPath', 'file');
     $form->maxFileSize = HSetting::Get('maxFileSize', 'file') / 1024 / 1024;
     $form->useXSendfile = HSetting::Get('useXSendfile', 'file');
     $form->forbiddenExtensions = HSetting::Get('forbiddenExtensions', 'file');
     // Ajax Validation
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'file-settings-form') {
         echo CActiveForm::validate($form);
         Yii::app()->end();
     }
     if (isset($_POST['FileSettingsForm'])) {
         $_POST['FileSettingsForm'] = Yii::app()->input->stripClean($_POST['FileSettingsForm']);
         $form->attributes = $_POST['FileSettingsForm'];
         if ($form->validate()) {
             $form->imageMagickPath = HSetting::Set('imageMagickPath', $form->imageMagickPath, 'file');
             $form->maxFileSize = HSetting::Set('maxFileSize', $form->maxFileSize * 1024 * 1024, 'file');
             $form->useXSendfile = HSetting::Set('useXSendfile', $form->useXSendfile, 'file');
             $form->forbiddenExtensions = HSetting::Set('forbiddenExtensions', strtolower($form->forbiddenExtensions), 'file');
             // set flash message
             Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved and flushed cache'));
             $this->redirect(Yii::app()->createUrl('//admin/setting/file'));
         }
     }
     // Determine PHP Upload Max FileSize
     $maxUploadSize = Helpers::GetBytesOfPHPIniValue(ini_get('upload_max_filesize'));
     if ($maxUploadSize > Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'))) {
         $maxUploadSize = Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'));
     }
     $maxUploadSize = floor($maxUploadSize / 1024 / 1024);
     // Determine currently used ImageLibary
     $currentImageLibary = 'GD';
     if (HSetting::Get('imageMagickPath', 'file')) {
         $currentImageLibary = 'ImageMagick';
     }
     $this->render('file', array('model' => $form, 'maxUploadSize' => $maxUploadSize, 'currentImageLibary' => $currentImageLibary));
 }
开发者ID:luizreginaldo,项目名称:humhub,代码行数:42,代码来源:SettingController.php

示例11: actionProxy

 /**
  * Proxy Settings
  */
 public function actionProxy()
 {
     Yii::import('admin.forms.*');
     $form = new ProxySettingsForm();
     // uncomment the following code to enable ajax-based validation
     /*        if (isset($_POST['ajax']) && $_POST['ajax'] === 'design-settings-form') {
               echo CActiveForm::validate($form);
               Yii::app()->end();
               } */
     if (isset($_POST['ProxySettingsForm'])) {
         $_POST['ProxySettingsForm'] = Yii::app()->input->stripClean($_POST['ProxySettingsForm']);
         $form->attributes = $_POST['ProxySettingsForm'];
         if ($form->validate()) {
             HSetting::Set('enabled', $form->enabled, 'proxy');
             HSetting::Set('server', $form->server, 'proxy');
             HSetting::Set('port', $form->port, 'proxy');
             HSetting::Set('user', $form->user, 'proxy');
             HSetting::Set('password', $form->password, 'proxy');
             HSetting::Set('noproxy', $form->noproxy, 'proxy');
             // set flash message
             Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_ProxyController', 'Saved'));
             $this->redirect(Yii::app()->createUrl('//admin/setting/proxy'));
         }
     } else {
         $form->enabled = HSetting::Get('enabled', 'proxy');
         $form->server = HSetting::Get('server', 'proxy');
         $form->port = HSetting::Get('port', 'proxy');
         $form->user = HSetting::Get('user', 'proxy');
         $form->password = HSetting::Get('password', 'proxy');
         $form->noproxy = HSetting::Get('noproxy', 'proxy');
     }
     $this->render('proxy', array('model' => $form));
 }
开发者ID:skapl,项目名称:design,代码行数:36,代码来源:SettingController.php

示例12: setupInitialData

 /**
  * Setup some inital database settings.
  *
  * This will be done at the first step.
  */
 private function setupInitialData()
 {
     // Seems database is already initialized
     if (HSetting::Get('paginationSize') == 10) {
         return;
     }
     // Rebuild Search
     HSearch::getInstance()->rebuild();
     HSetting::Set('baseUrl', Yii::app()->getBaseUrl(true));
     HSetting::Set('paginationSize', 10);
     HSetting::Set('displayNameFormat', '{profile.firstname} {profile.lastname}');
     // Authentication
     HSetting::Set('authInternal', '1', 'authentication');
     HSetting::Set('authLdap', '0', 'authentication');
     HSetting::Set('needApproval', '0', 'authentication_internal');
     HSetting::Set('anonymousRegistration', '1', 'authentication_internal');
     HSetting::Set('internalUsersCanInvite', '1', 'authentication_internal');
     // Mailing
     HSetting::Set('transportType', 'php', 'mailing');
     HSetting::Set('systemEmailAddress', 'social@example.com', 'mailing');
     HSetting::Set('systemEmailName', 'My Social Network', 'mailing');
     HSetting::Set('receive_email_activities', User::RECEIVE_EMAIL_DAILY_SUMMARY, 'mailing');
     HSetting::Set('receive_email_notifications', User::RECEIVE_EMAIL_WHEN_OFFLINE, 'mailing');
     // File
     HSetting::Set('maxFileSize', '1048576', 'file');
     HSetting::Set('forbiddenExtensions', 'exe', 'file');
     // Caching
     HSetting::Set('type', 'CFileCache', 'cache');
     HSetting::Set('expireTime', '3600', 'cache');
     HSetting::Set('installationId', md5(uniqid("", true)), 'admin');
     // Design
     HSetting::Set('theme', "HumHub");
     // Basic
     HSetting::Set('enable', 1, 'tour');
     // Add Categories
     $cGeneral = new ProfileFieldCategory();
     $cGeneral->title = "General";
     $cGeneral->sort_order = 100;
     $cGeneral->visibility = 1;
     $cGeneral->is_system = true;
     $cGeneral->description = '';
     $cGeneral->save();
     $cCommunication = new ProfileFieldCategory();
     $cCommunication->title = "Communication";
     $cCommunication->sort_order = 200;
     $cCommunication->visibility = 1;
     $cCommunication->is_system = true;
     $cCommunication->description = '';
     $cCommunication->save();
     $cSocial = new ProfileFieldCategory();
     $cSocial->title = "Social bookmarks";
     $cSocial->sort_order = 300;
     $cSocial->visibility = 1;
     $cSocial->is_system = true;
     $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 = 'ProfileFieldTypeText';
     $field->ldap_attribute = 'givenName';
     $field->is_system = true;
     $field->required = true;
     $field->show_at_registration = true;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $field->fieldType->save();
     }
     $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 = 'ProfileFieldTypeText';
     $field->ldap_attribute = 'sn';
     $field->show_at_registration = true;
     $field->required = true;
     $field->is_system = true;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
         $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 = 'ProfileFieldTypeText';
     $field->is_system = true;
     if ($field->save()) {
         $field->fieldType->maxLength = 100;
//.........这里部分代码省略.........
开发者ID:luizreginaldo,项目名称:humhub,代码行数:101,代码来源:ConfigController.php

示例13: run

 /**
  * Run method for CronRunner
  *
  * @param type $args
  */
 public function run($args)
 {
     $this->printHeader('Cron Interface');
     if (!isset($args[0]) || $args[0] != "daily" && $args[0] != 'hourly') {
         print "\n Run with parameter:\n" . "\t daily - for Daily Interval\n" . "\t hourly - for Hourly Interval \n";
         print "\n\n";
         exit;
     }
     // Set current interval to attribute
     if ($args[0] == 'daily') {
         $this->interval = self::INTERVAL_DAILY;
     } elseif ($args[0] == 'hourly') {
         $this->interval = self::INTERVAL_HOURLY;
     } else {
         throw new CException(500, 'Invalid cron interval!');
     }
     // Do some base tasks, handle by event in future
     if ($this->interval == self::INTERVAL_HOURLY) {
         // Raise Event for Module specific tasks
         if ($this->hasEventHandler('onHourlyRun')) {
             $this->onHourlyRun(new CEvent($this));
         }
         print "- Optimizing Search Index\n";
         // Optimize Search Index
         HSearch::getInstance()->Optimize();
         if (HSetting::Get('enabled', 'authentication_ldap') && HSetting::Get('refreshUsers', 'authentication_ldap')) {
             print "- Updating LDAP Users\n";
             HLdap::getInstance()->refreshUsers();
         }
         print "- Invoking EMailing hourly\n\n";
         // Execute Hourly Mailing Runner
         Yii::import('application.commands.shell.EMailing.*');
         $command = new EMailing('test', 'test');
         $command->run(array('hourly'));
         HSetting::Set('cronLastHourlyRun', time());
     } elseif ($this->interval == self::INTERVAL_DAILY) {
         // Raise Event for Module specific tasks
         if ($this->hasEventHandler('onDailyRun')) {
             $this->onDailyRun(new CEvent($this));
         }
         // Execute Daily Mailing Runner
         print "- Invoking EMailing daily\n\n";
         Yii::import('application.commands.shell.EMailing.*');
         $command = new EMailing('test', 'test');
         $command->run(array('daily'));
         HSetting::Set('cronLastDailyRun', time());
     }
 }
开发者ID:skapl,项目名称:design,代码行数:53,代码来源:ZCronRunner.php

示例14: testGroupAssignment

 public function testGroupAssignment()
 {
     $group2 = new Group();
     $group2->name = "TestGrp1";
     $group2->description = "test";
     $this->assertTrue($group2->save());
     HSetting::Set('defaultUserGroup', $group2->id, 'authentication_internal');
     $user = new User();
     $user->username = "TestSpaceAutoAdd";
     $user->email = "testautoadd@example.com";
     $this->assertTrue($user->save());
     $this->assertEquals($user->group_id, $group2->id);
 }
开发者ID:alefernie,项目名称:intranet,代码行数:13,代码来源:UserTest.php


注:本文中的HSetting::Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。