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


PHP Config::save方法代码示例

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


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

示例1: run

 public function run()
 {
     $cfg = new Config();
     $pNum = (int) $cfg->get('OLD_VERSION_JOB_PAGE_NUM');
     $pNum = $pNum < 0 ? 1 : $pNum + 1;
     $pl = new PageList();
     $pl->setItemsPerPage(3);
     /* probably want to keep a record of pages that have been gone through 
      * so you don't start from the beginning each time..
      */
     $pages = $pl->getPage($pNum);
     if (!count($pages)) {
         $cfg->save('OLD_VERSION_JOB_PAGE_NUM', 0);
         return t("All pages have been processed, starting from beginning on next run.");
     }
     $versionCount = 0;
     $pagesAffected = array();
     foreach ($pages as $page) {
         if ($page instanceof Page) {
             $pvl = new VersionList($page);
             $pagesAffected[] = $page->getCollectionID();
             foreach (array_slice(array_reverse($pvl->getVersionListArray()), 10) as $v) {
                 if ($v instanceof CollectionVersion && !$v->isApproved() && !$v->isMostRecent()) {
                     @$v->delete();
                     $versionCount++;
                 }
             }
         }
     }
     $pageCount = count($pagesAffected);
     $cfg->save('OLD_VERSION_JOB_PAGE_NUM', $pNum);
     //i18n: %1$d is the number of versions deleted, %2$d is the number of affected pages, %3$d is the number of times that the Remove Old Page Versions job has been executed.
     return t2('%1$d versions deleted from %2$d page (%3$d)', '%1$d versions deleted from %2$d pages (%3$s)', $pageCount, $versionCount, $pageCount, implode(',', $pagesAffected));
 }
开发者ID:ronlobo,项目名称:concrete5,代码行数:34,代码来源:remove_old_page_versions.php

示例2: run

 public function run()
 {
     //$u = new User();
     //if(!$u->isSuperUser()) { die(t("Access Denied."));} // cheap security check...
     $cfg = new Config();
     Loader::model('page_list');
     $pl = new PageList();
     //$pl->ignorePermissions();
     $pNum = $cfg->get('OLD_VERSION_JOB_PAGE_NUM');
     if ($pNum <= 0) {
         $cfg->save('OLD_VERSION_JOB_PAGE_NUM', 0);
     }
     $pl->setItemsPerPage(3);
     /* probably want to keep a record of pages that have been gone through 
      * so you don't start from the beginning each time..
      */
     $pNum = $pNum + 1;
     $pages = $pl->getPage($pNum);
     $cfg->save('OLD_VERSION_JOB_PAGE_NUM', $pNum);
     $pageCount = 0;
     $versionCount = 0;
     if (count($pages) == 0) {
         $cfg->save('OLD_VERSION_JOB_PAGE_NUM', 0);
         return t("All pages have been processes, starting from beginning on next run.");
     }
     foreach ($pages as $page) {
         if ($page instanceof Page) {
             $pvl = new VersionList($page);
             $versions = $pvl->getVersionListArray();
             $versions = array_reverse($versions);
             $vCount = count($versions);
             if ($vCount <= 10) {
                 continue;
             }
             $pageCount++;
             $stopAt = $vCount - 10;
             $i = 0;
             foreach ($versions as $v) {
                 if ($v instanceof CollectionVersion) {
                     if ($v->isApproved() || $v->isMostRecent()) {
                         // may want to add a date check here too
                         continue;
                     } else {
                         @$v->delete();
                         $versionCount++;
                     }
                 }
                 $i++;
                 if ($i >= $stopAt) {
                     break;
                 }
             }
         }
     }
     $pages = $pageCount == 1 ? t("Page") : t("Pages");
     return $versionCount . " " . t("versions deleted from") . " " . $pageCount . " " . $pages . " (" . $pNum . ")";
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:57,代码来源:remove_old_page_versions.php

示例3: saveAuthenticationType

 public function saveAuthenticationType($args)
 {
     \Config::save('auth.facebook.appid', $args['apikey']);
     \Config::save('auth.facebook.secret', $args['apisecret']);
     \Config::save('auth.facebook.registration.enabled', (bool) $args['registration_enabled']);
     \Config::save('auth.facebook.registration.group', intval($args['registration_group'], 10));
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:7,代码来源:controller.php

示例4: saveAuthenticationType

 public function saveAuthenticationType($args)
 {
     \Config::save('auth.worldskills.appid', $args['apikey']);
     \Config::save('auth.worldskills.secret', $args['apisecret']);
     \Config::save('auth.worldskills.roles_application_code', $args['roles_application_code']);
     \Config::save('auth.worldskills.registration.group', intval($args['registration_group'], 10));
 }
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:7,代码来源:Controller.php

示例5: update_profiles

	public function update_profiles() { 
		if ($this->isPost()) {
			Config::save('ENABLE_USER_PROFILES', ($this->post('public_profiles')?true:false));
			$message = ($this->post('public_profiles')?t('Public profiles have been enabled'):t('Public profiles have been disabled.'));
			$this->redirect('/dashboard/system/registration/profiles',$message);
		}
	}
开发者ID:nbourguig,项目名称:concrete5,代码行数:7,代码来源:controller.php

示例6: SaveProfile

 public function SaveProfile(Button $button)
 {
     $form = $button->getForm();
     $values = $form->getValues();
     try {
         if ($this->mode == 'superadmin') {
             if (isset($values['password_new'])) {
                 if ($values['password'] == $this->profile_data['password']) {
                     if ($values['password_new'] == $values['password_new_confirm']) {
                         $values['password'] = $values['password_new'];
                     } else {
                         throw new AuthenticationException('New password does not match.');
                     }
                 } else {
                     throw new AuthenticationException('Old password does not match with provided password.');
                 }
             } else {
                 unset($values['password']);
             }
             unset($values['password_new']);
             unset($values['password_new_confirm']);
             $this->config_data['admin'] = array_merge($this->config_data['admin'], $values);
             $config = new Config();
             $config->import($this->config_data);
             $config->save(APP_DIR . '/config/admin.ini', 'admin');
             $this->flash('Super admin profile updated');
         }
     } catch (Exception $e) {
         $this->flash($e->getMessage(), 'error');
     }
     $this->end();
 }
开发者ID:bazo,项目名称:Mokuji,代码行数:32,代码来源:AdminMyProfilePresenter.php

示例7: txt_editor_config

	function txt_editor_config(){
		if (!$this->token->validate("txt_editor_config")) { 
			$this->error->add($this->token->getErrorMessage());
		}

		$textEditorWidth = intval($this->post('CONTENTS_TXT_EDITOR_WIDTH'));
		if( $textEditorWidth<580 ) {
			$this->error->add(t('The editor must be at least 580 pixels wide.'));
		}
		$textEditorHeight = intval($this->post('CONTENTS_TXT_EDITOR_HEIGHT'));
		if( $textEditorHeight<100 ) {
			$this->error->add(t('The editor must be at least 100 pixels tall.'));
		}
		
		if (!$this->error->has()) { 
 			Config::save('CONTENTS_TXT_EDITOR_MODE', $this->post('CONTENTS_TXT_EDITOR_MODE') );
			Config::save( 'CONTENTS_TXT_EDITOR_WIDTH', $textEditorWidth );
			Config::save( 'CONTENTS_TXT_EDITOR_HEIGHT', $textEditorHeight );	
			
			$db = Loader::db();
			$values=array( $textEditorWidth, $textEditorHeight );
			$db->query( 'UPDATE BlockTypes SET btInterfaceWidth=?, btInterfaceHeight=? where btHandle = "content"', $values );
			
			if($this->post('CONTENTS_TXT_EDITOR_MODE')=='CUSTOM')
				Config::save('CONTENTS_TXT_EDITOR_CUSTOM_CODE', $this->post('CONTENTS_TXT_EDITOR_CUSTOM_CODE') );
 			$this->redirect('/dashboard/system/basics/editor', 'txt_editor_config_saved'); 
		}
	}
开发者ID:nbourguig,项目名称:concrete5,代码行数:28,代码来源:controller.php

示例8: saveAuthenticationType

 public function saveAuthenticationType($args)
 {
     \Config::save('auth.community.appid', $args['apikey']);
     \Config::save('auth.community.secret', $args['apisecret']);
     \Config::save('auth.community.registration.enabled', !!$args['registration_enabled']);
     \Config::save('auth.community.registration.group', intval($args['registration_group'], 10));
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:7,代码来源:controller.php

示例9: getOrCreate

 public static function getOrCreate($groups)
 {
     $db = Loader::db();
     $petID = $db->GetOne('select petID from PermissionAccessEntityTypes where petHandle = \'group_combination\'');
     $q = 'select pae.peID from PermissionAccessEntities pae ';
     $i = 1;
     foreach ($groups as $g) {
         $q .= 'left join PermissionAccessEntityGroups paeg' . $i . ' on pae.peID = paeg' . $i . '.peID ';
         $i++;
     }
     $q .= 'where petID = ? ';
     $i = 1;
     foreach ($groups as $g) {
         $q .= 'and paeg' . $i . '.gID = ' . $g->getGroupID() . ' ';
         $i++;
     }
     $peID = $db->GetOne($q, array($petID));
     if (!$peID) {
         $db->Execute("insert into PermissionAccessEntities (petID) values (?)", array($petID));
         Config::save('ACCESS_ENTITY_UPDATED', time());
         $peID = $db->Insert_ID();
         foreach ($groups as $g) {
             $db->Execute('insert into PermissionAccessEntityGroups (peID, gID) values (?, ?)', array($peID, $g->getGroupID()));
         }
     }
     return PermissionAccessEntity::getByID($peID);
 }
开发者ID:nanpou,项目名称:concrete5,代码行数:27,代码来源:group_combination.php

示例10: update_registration_type

 public function update_registration_type()
 {
     if ($this->isPost()) {
         Config::save('ENABLE_OPENID_AUTHENTICATION', $this->post('enable_openID') ? true : false);
         Config::save('USER_REGISTRATION_WITH_EMAIL_ADDRESS', $this->post('email_as_username') ? true : false);
         Config::save('REGISTRATION_TYPE', $this->post('registration_type'));
         Config::save('ENABLE_REGISTRATION_CAPTCHA', $this->post('enable_registration_captcha') ? true : false);
         switch ($this->post('registration_type')) {
             case "enabled":
                 Config::save('ENABLE_REGISTRATION', true);
                 Config::save('USER_VALIDATE_EMAIL', false);
                 Config::save('USER_VALIDATE_EMAIL_REQUIRED', false);
                 Config::save('USER_REGISTRATION_APPROVAL_REQUIRED', false);
                 break;
             case "validate_email":
                 Config::save('ENABLE_REGISTRATION', true);
                 Config::save('USER_VALIDATE_EMAIL', true);
                 Config::save('USER_VALIDATE_EMAIL_REQUIRED', true);
                 Config::save('USER_REGISTRATION_APPROVAL_REQUIRED', false);
                 break;
             case "manual_approve":
                 Config::save('ENABLE_REGISTRATION', true);
                 Config::save('USER_REGISTRATION_APPROVAL_REQUIRED', true);
                 Config::save('USER_VALIDATE_EMAIL', false);
                 Config::save('USER_VALIDATE_EMAIL_REQUIRED', false);
                 break;
             default:
                 // disabled
                 Config::save('ENABLE_REGISTRATION', false);
                 break;
         }
         Config::save('REGISTRATION_TYPE', $this->post('registration_type'));
         $this->redirect('/dashboard/system/registration/public_registration', t('Registration settings have been saved.'));
     }
 }
开发者ID:rmxdave,项目名称:concrete5,代码行数:35,代码来源:controller.php

示例11: enterAction

 public function enterAction()
 {
     $config = Config::share();
     if (!empty($_POST['systemPass'])) {
         if (empty($config['systemPass'])) {
             $config['systemPass'] = password_hash($_POST['systemPass'], PASSWORD_DEFAULT);
             $config['installed'] = true;
             Config::save('share', $config);
         }
         if (password_verify($_POST['systemPass'], $config['systemPass'])) {
             $_SESSION['systemLogin'] = 1;
         } else {
             if (empty($config['failTry'])) {
                 $config['failTry'] = 1;
             } else {
                 $config['failTry']++;
             }
             Config::save('share', $config);
         }
         Tools::redirect('/setup');
     }
     if (!empty($config['systemPass']) && !empty($_COOKIE['systemPass']) && $_COOKIE['systemPass'] == $config['systemPass']) {
         Tools::redirect('/setup');
     }
     $this->view->setTitle('Enter');
     $this->view->page();
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:27,代码来源:MainController.php

示例12: save

 public function save()
 {
     $helper_file = Loader::helper('concrete/file');
     $validation_token = Loader::helper('validation/token');
     Loader::model('file_storage_location');
     if (!$validation_token->validate("file_storage")) {
         $this->set('error', array($validation_token->getErrorMessage()));
         return;
     }
     if ($_POST['delete']) {
         $fsl = FileStorageLocation::getByID(FileStorageLocation::ALTERNATE_ID);
         if (is_object($fsl)) {
             $fsl->delete();
             $this->redirect('/dashboard/system/environment/file_storage_locations', 'storage_deleted');
         }
     } else {
         Config::save('DIR_FILES_UPLOADED', $this->post('DIR_FILES_UPLOADED'));
         if ($this->post('fslName') != '' && $this->post('fslDirectory') != '') {
             $fsl = FileStorageLocation::getByID(FileStorageLocation::ALTERNATE_ID);
             if (!is_object($fsl)) {
                 FileStorageLocation::add($this->post('fslName'), $this->post('fslDirectory'), FileStorageLocation::ALTERNATE_ID);
             } else {
                 $fsl->update($this->post('fslName'), $this->post('fslDirectory'));
             }
         }
         $this->redirect('/dashboard/system/environment/file_storage_locations', 'storage_saved');
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:28,代码来源:file_storage_locations.php

示例13: update_library

 public function update_library()
 {
     if (Loader::helper("validation/token")->validate('update_library')) {
         if ($this->post('activeLibrary')) {
             $scl = SystemAntispamLibrary::getByHandle($this->post('activeLibrary'));
             if (is_object($scl)) {
                 $scl->activate();
                 Config::save('ANTISPAM_NOTIFY_EMAIL', $this->post('ANTISPAM_NOTIFY_EMAIL'));
                 Config::save('ANTISPAM_LOG_SPAM', $this->post('ANTISPAM_LOG_SPAM'));
                 if ($scl->hasOptionsForm() && $this->post('ccm-submit-submit')) {
                     $controller = $scl->getController();
                     $controller->saveOptions($this->post());
                 }
                 $this->redirect('/dashboard/system/permissions/antispam', 'saved');
             } else {
                 $this->error->add(t('Invalid anti-spam library.'));
             }
         } else {
             SystemAntispamLibrary::deactivateAll();
         }
     } else {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     $this->view();
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:25,代码来源:antispam.php

示例14: view

 public function view($updated = false)
 {
     Loader::library('database_indexed_search');
     if ($this->post('reindex')) {
         IndexedSearch::clearSearchIndex();
         $this->redirect('/dashboard/system/seo/search_index', 'index_cleared');
     } else {
         if ($updated) {
             $this->set('message', t('Search Index Preferences Updated'));
         }
         if ($this->isPost()) {
             if ($this->token->validate('update_search_index')) {
                 $areas = $this->post('arHandle');
                 if (!is_array($areas)) {
                     $areas = array();
                 }
                 Config::save('SEARCH_INDEX_AREA_LIST', serialize($areas));
                 Config::save('SEARCH_INDEX_AREA_METHOD', Loader::helper('security')->sanitizeString($this->post('SEARCH_INDEX_AREA_METHOD')));
                 $this->redirect('/dashboard/system/seo/search_index', 'updated');
             } else {
                 $this->set('error', array($this->token->getErrorMessage()));
             }
         }
         $areas = Area::getHandleList();
         $selectedAreas = array();
         $this->set('areas', $areas);
         $this->set('selectedAreas', IndexedSearch::getSavedSearchableAreas());
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:29,代码来源:search_index.php

示例15: update_favicon

	function update_favicon(){
		Loader::library('file/importer');
		if ($this->token->validate("update_favicon")) { 
		
			if(intval($this->post('remove_favicon'))==1){
				Config::save('FAVICON_FID',0);
					$this->redirect('/dashboard/system/basics/icons/', 'favicon_removed');
			} else {
				$fi = new FileImporter();
				$resp = $fi->import($_FILES['favicon_file']['tmp_name'], $_FILES['favicon_file']['name'], $fr);
				if (!($resp instanceof FileVersion)) {
					switch($resp) {
						case FileImporter::E_FILE_INVALID_EXTENSION:
							$this->error->add(t('Invalid file extension.'));
							break;
						case FileImporter::E_FILE_INVALID:
							$this->error->add(t('Invalid file.'));
							break;
						
					}
				} else {
				
					Config::save('FAVICON_FID', $resp->getFileID());
					$filepath=$resp->getPath();  
					//@copy($filepath, DIR_BASE.'/favicon.ico');
					$this->redirect('/dashboard/system/basics/icons/', 'favicon_saved');

				}
			}		
			
		}else{
			$this->set('error', array($this->token->getErrorMessage()));
		}
	}
开发者ID:nveid,项目名称:concrete5,代码行数:34,代码来源:icons.php


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