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


PHP JClientHelper::setCredentials方法代码示例

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


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

示例1: setCredentialsFromRequest

 /**
  * Determine whether input fields for client settings need to be shown
  *
  * If valid credentials were passed along with the request, they are saved to the session.
  * This functions returns an exception if invalid credentials have been given or if the
  * connection to the server failed for some other reason.
  *
  * @param   string  $client  The name of the client.
  *
  * @return  mixed  True, if FTP settings should be shown or an exception
  *
  * @since   11.1
  */
 public static function setCredentialsFromRequest($client)
 {
     // Determine wether FTP credentials have been passed along with the current request
     $user = JRequest::getString('username', null, 'POST', JREQUEST_ALLOWRAW);
     $pass = JRequest::getString('password', null, 'POST', JREQUEST_ALLOWRAW);
     if ($user != '' && $pass != '') {
         // Add credentials to the session
         if (JClientHelper::setCredentials($client, $user, $pass)) {
             $return = false;
         } else {
             $return = JError::raiseWarning('SOME_ERROR_CODE', JText::_('JLIB_CLIENT_ERROR_HELPER_SETCREDENTIALSFROMREQUEST_FAILED'));
         }
     } else {
         // Just determine if the FTP input fields need to be shown
         $return = !JClientHelper::hasCredentials('ftp');
     }
     return $return;
 }
开发者ID:Radek-Suski,项目名称:joomla-platform,代码行数:31,代码来源:helper.php

示例2: _applyCredentials

 /**
  * Applies FTP credentials to Joomla! itself, when required
  *
  * @return  void
  *
  * @since	2.5.4
  */
 protected function _applyCredentials()
 {
     if (!JClientHelper::hasCredentials('ftp')) {
         $user = JFactory::getApplication()->getUserStateFromRequest('com_joomlaupdate.ftp_user', 'ftp_user', null, 'raw');
         $pass = JFactory::getApplication()->getUserStateFromRequest('com_joomlaupdate.ftp_pass', 'ftp_pass', null, 'raw');
         if ($user != '' && $pass != '') {
             // Add credentials to the session
             if (!JClientHelper::setCredentials('ftp', $user, $pass)) {
                 JError::raiseWarning('SOME_ERROR_CODE', JText::_('JLIB_CLIENT_ERROR_HELPER_SETCREDENTIALSFROMREQUEST_FAILED'));
             }
         }
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:20,代码来源:update.php

示例3:

 /**
  * Determine wether input fields for client settings need to be shown
  *
  * If valid credentials were passed along with the request, they are saved to the session.
  * This functions returns an exeption if invalid credentials have been given or if the
  * connection to the server failed for some other reason.
  * @static
  * @return	boolean|JExeption	True, if FTP settings should be shown, or an exeption
  * @since	1.5
  */
 function &setCredentialsFromRequest($client)
 {
     // Determine wether FTP credentials have been passed along with the current request
     $user = JRequest::getString('username', null, 'POST', JREQUEST_ALLOWRAW);
     $pass = JRequest::getString('password', null, 'POST', JREQUEST_ALLOWRAW);
     if ($user != '' && $pass != '') {
         // Add credentials to the session
         if (JClientHelper::setCredentials($client, $user, $pass)) {
             $return = false;
         } else {
             $return =& JError::raiseWarning('SOME_ERROR_CODE', 'JClientHelper::setCredentialsFromRequest failed');
         }
     } else {
         // Just determine if the FTP input fields need to be shown
         $return = !JClientHelper::hasCredentials('ftp');
     }
     return $return;
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:28,代码来源:helper.php

示例4: setCredentials

 /**
  * Helper wrapper method for setCredentials
  *
  * @param   string  $client  Client name, currently only 'ftp' is supported
  * @param   string  $user    Username
  * @param   string  $pass    Password
  *
  * @return boolean  True if the given login credentials have been set and are valid
  *
  * @see     JClientHelper::setCredentials()
  * @since   3.4
  */
 public function setCredentials($client, $user, $pass)
 {
     return JClientHelper::setCredentials($client, $user, $pass);
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:16,代码来源:helper.php

示例5: needsFTPCredentials

 /**
  * Does the user need to provide FTP credentials? It also registers any FTP credentials provided in the URL.
  *
  * @return  bool  True if the user needs to provide FTP credentials
  */
 public function needsFTPCredentials()
 {
     // Determine wether FTP credentials have been passed along with the current request
     \JLoader::import('joomla.client.helper');
     $user = $this->input->get('username', null, 'raw');
     $pass = $this->input->get('password', null, 'raw');
     if (!($user == '' && $pass == '')) {
         // Add credentials to the session
         if (\JClientHelper::setCredentials('ftp', $user, $pass)) {
             return false;
         }
         return true;
     }
     return !\JClientHelper::hasCredentials('ftp');
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:20,代码来源:Updates.php

示例6: _applyFTPCredentials

 private function _applyFTPCredentials()
 {
     $session = JFactory::getSession();
     $credentials = $session->get('ftp', array('user' => '', 'pass' => ''), 'akeeba');
     JClientHelper::setCredentials('ftp', $credentials['user'], $credentials['pass']);
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:6,代码来源:srp.php

示例7: getFTPOptions

 /**
  * Returns an array with the configured FTP options
  *
  * @return  array
  */
 public function getFTPOptions()
 {
     // Initialise from Joomla! Global Configuration
     $config = JFactory::getConfig();
     $retArray = array('enable' => $config->get('ftp_enable', 0), 'host' => $config->get('ftp_host', 'localhost'), 'port' => $config->get('ftp_port', '21'), 'user' => $config->get('ftp_user', ''), 'pass' => $config->get('ftp_pass', ''), 'root' => $config->get('ftp_root', ''), 'tempdir' => $config->get('tmp_path', ''));
     // Get the username and password from the state variables, if it exists
     $stateUser = '';
     //$this->getState('user', '', 'raw');
     $statePass = '';
     //$this->getState('pass', '', 'raw');
     if (!empty($stateUser)) {
         $retArray['user'] = $stateUser;
     }
     if (!empty($statePass)) {
         $retArray['pass'] = $statePass;
     }
     // Apply the FTP credentials to Joomla! itself
     JLoader::import('joomla.client.helper');
     JClientHelper::setCredentials('ftp', $retArray['user'], $retArray['pass']);
     return $retArray;
 }
开发者ID:ranamimran,项目名称:persivia,代码行数:26,代码来源:bfUpgrade.php


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