當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PEAR_Config::store方法代碼示例

本文整理匯總了PHP中PEAR_Config::store方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_Config::store方法的具體用法?PHP PEAR_Config::store怎麽用?PHP PEAR_Config::store使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PEAR_Config的用法示例。


在下文中一共展示了PEAR_Config::store方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setPassword

 /**
  * (non-PHPdoc)
  * @see lib/Faett/Core/Interfaces/Faett_Core_Interfaces_Service#setPassword()
  */
 public function setPassword($password, $channel, $layer = 'user')
 {
     // set password for channel
     $this->_config->set('password', $password, $layer, $channel);
     // write config
     $this->_config->store($layer);
 }
開發者ID:BGCX067,項目名稱:faett-core-svn-to-git,代碼行數:11,代碼來源:Service.php

示例2: doLogin

 /**
  * Execute the 'login' command.
  *
  * @param string $command command name
  *
  * @param array $options option_name => value
  *
  * @param array $params list of additional parameters
  *
  * @return bool TRUE on success or
  * a PEAR error on failure
  *
  * @access public
  */
 function doLogin($command, $options, $params)
 {
     $reg =& $this->config->getRegistry();
     // If a parameter is supplied, use that as the channel to log in to
     if (isset($params[0])) {
         $channel = $params[0];
     } else {
         $channel = $this->config->get('default_channel');
     }
     $chan = $reg->getChannel($channel);
     if (PEAR::isError($chan)) {
         return $this->raiseError($chan);
     }
     $server = $this->config->get('preferred_mirror', null, $channel);
     $remote =& $this->config->getRemote();
     $username = $this->config->get('username', null, $channel);
     if (empty($username)) {
         $username = isset($_ENV['USER']) ? $_ENV['USER'] : null;
     }
     $this->ui->outputData("Logging in to {$server}.", $command);
     list($username, $password) = $this->ui->userDialog($command, array('Username', 'Password'), array('text', 'password'), array($username, ''));
     $username = trim($username);
     $password = trim($password);
     $ourfile = $this->config->getConfFile('user');
     if (!$ourfile) {
         $ourfile = $this->config->getConfFile('system');
     }
     $this->config->set('username', $username, 'user', $channel);
     $this->config->set('password', $password, 'user', $channel);
     if ($chan->supportsREST()) {
         $ok = true;
     } else {
         $remote->expectError(401);
         $ok = $remote->call('logintest');
         $remote->popExpect();
     }
     if ($ok === true) {
         $this->ui->outputData("Logged in.", $command);
         // avoid changing any temporary settings changed with -d
         $ourconfig = new PEAR_Config($ourfile, $ourfile);
         $ourconfig->set('username', $username, 'user', $channel);
         $ourconfig->set('password', $password, 'user', $channel);
         $ourconfig->store();
     } else {
         return $this->raiseError("Login failed!");
     }
     return true;
 }
開發者ID:poppen,項目名稱:p2,代碼行數:62,代碼來源:Auth.php


注:本文中的PEAR_Config::store方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。