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


PHP JClientHelper::getCredentials方法代码示例

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


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

示例1: saveParams

 /**
  * TuiyoParameter::saveParams()
  * 
  * @param mixed $postParams
  * @param mixed $key
  * @param string $type
  * @return
  */
 public function saveParams($postParams, $key, $type = "system")
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.client.helper');
     // Set FTP credentials, if given
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     $file = TUIYO_CONFIG . DS . strtolower($key) . ".ini";
     if (JFile::exists($file)) {
         JFile::write($file);
     }
     if (count($postParams)) {
         $registry = new JRegistry();
         $registry->loadArray($postParams);
         $iniTxt = $registry->toString();
         // Try to make the params file writeable
         if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
             JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file writable'));
             return false;
         }
         //Write the file
         $return = JFile::write($file, $iniTxt);
         // Try to make the params file unwriteable
         if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
             JError::raiseNotice('SOME_ERROR_CODE', _('Could not make the template parameter file unwritable'));
             return false;
         }
         if (!$return) {
             JError::raiseError(TUIYO_SERVER_ERROR, _("Could not save the template parameters"));
             return false;
         }
         return $return;
     }
 }
开发者ID:night-coder,项目名称:ignite,代码行数:42,代码来源:parameter.php

示例2: com_install

function com_install()
{
    global $mainframe;
    jimport('joomla.filesystem.folder');
    // Initialize variables
    jimport('joomla.client.helper');
    $FTPOptions = JClientHelper::getCredentials('ftp');
    $language =& JFactory::getLanguage();
    $language->load('com_jce_imgmanager_ext', JPATH_SITE);
    $cache = $mainframe->getCfg('tmp_path');
    // Check for tmp folder
    if (!JFolder::exists($cache)) {
        // Create if does not exist
        if (!JFolder::create($cache)) {
            $mainframe->enqueueMessage(JText::_('NO CACHE DESC'), 'error');
        }
    }
    // Check if folder exists and is writable or the FTP layer is enabled
    if (JFolder::exists($cache) && (is_writable($cache) || $FTPOptions['enabled'] == 1)) {
        $mainframe->enqueueMessage(JText::_('CACHE DESC'));
    } else {
        $mainframe->enqueueMessage(JText::_('NO CACHE DESC'), 'error');
    }
    // Check for GD
    if (!function_exists('gd_info')) {
        $mainframe->enqueueMessage(JText::_('NO GD DESC'), 'error');
    } else {
        $info = gd_info();
        $mainframe->enqueueMessage(JText::_('GD DESC') . ' - ' . $info['GD Version']);
    }
}
开发者ID:Ratmir15,项目名称:Joomla---formula-of-success,代码行数:31,代码来源:install.php

示例3: admin_postinstall_eaccelerator_action

/**
 * Disables the unsupported eAccelerator caching method, replacing it with the
 * "file" caching method.
 *
 * @return  void
 *
 * @since   3.2
 */
function admin_postinstall_eaccelerator_action()
{
    $prev = new JConfig();
    $prev = JArrayHelper::fromObject($prev);
    $data = array('cacheHandler' => 'file');
    $data = array_merge($prev, $data);
    $config = new Registry('config');
    $config->loadArray($data);
    jimport('joomla.filesystem.path');
    jimport('joomla.filesystem.file');
    // Set the configuration file path.
    $file = JPATH_CONFIGURATION . '/configuration.php';
    // Get the new FTP credentials.
    $ftp = JClientHelper::getCredentials('ftp', true);
    // Attempt to make the file writeable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
    }
    // Attempt to write the configuration file as a PHP class named JConfig.
    $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
    if (!JFile::write($file, $configuration)) {
        JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
        return;
    }
    // Attempt to make the file unwriteable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
    }
}
开发者ID:grlf,项目名称:eyedock,代码行数:37,代码来源:eaccelerator.php

示例4: save

 function save($data)
 {
     // Get the previous configuration.
     if (is_object($data)) {
         $data = JArrayHelper::fromObject($data);
     }
     $prev = JTheFactoryHelper::getConfig();
     $prev = JArrayHelper::fromObject($prev);
     $data = array_merge($prev, $data);
     $configfile = JTheFactoryAdminHelper::getConfigFile();
     $config = new JRegistry('config');
     $config->loadArray($data);
     jimport('joomla.filesystem.path');
     jimport('joomla.filesystem.file');
     jimport('joomla.client.helper');
     // Get the new FTP credentials.
     $ftp = JClientHelper::getCredentials('ftp', true);
     // Attempt to make the file writeable if using FTP.
     if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0644')) {
         JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE'));
     }
     // Attempt to write the configuration file as a PHP class named JConfig.
     $configString = $config->toString('PHP', array('class' => ucfirst(APP_PREFIX) . "Config", 'closingtag' => false));
     if (!JFile::write($configfile, $configString)) {
         JError::raiseWarning(101, JText::_('FACTORY_SETTINGS_FILE_WRITE_FAILED'));
         return false;
     }
     // Attempt to make the file unwriteable if using FTP.
     if (!$ftp['enabled'] && JPath::isOwner($configfile) && !JPath::setPermissions($configfile, '0444')) {
         JError::raiseNotice(101, JText::_('FACTORY_SETTINGS_FILE_IS_NOT_WRITABLE'));
     }
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:33,代码来源:config.php

示例5: com_install

function com_install()
{
    $mainframe = JFactory::getApplication();
    jimport('joomla.filesystem.folder');
    // Initialize variables
    jimport('joomla.client.helper');
    $FTPOptions = JClientHelper::getCredentials('ftp');
    $language = JFactory::getLanguage();
    $language->load('com_jce_imgmanager_ext', JPATH_SITE);
    $cache = $mainframe->getCfg('tmp_path');
    // Check for tmp folder
    if (!JFolder::exists($cache)) {
        // Create if does not exist
        if (!JFolder::create($cache)) {
            $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error');
        }
    }
    // Check if folder exists and is writable or the FTP layer is enabled
    if (JFolder::exists($cache) && (is_writable($cache) || $FTPOptions['enabled'] == 1)) {
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_CACHE_DESC'));
    } else {
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_CACHE_DESC'), 'error');
    }
    // Check for GD
    if (!function_exists('gd_info')) {
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_NO_GD_DESC'), 'error');
    } else {
        $info = gd_info();
        $mainframe->enqueueMessage(WFText::_('WF_IMGMANAGER_EXT_GD_DESC') . ' - ' . $info['GD Version']);
    }
    // remove wideimage folder
    if (JFolder::exists(dirname(__FILE) . '/classes/wideimage')) {
        @JFolder::delete(dirname(__FILE) . '/classes/wideimage');
    }
}
开发者ID:adjaika,项目名称:J3Base,代码行数:35,代码来源:install.php

示例6: jimport

 /**
  * Creates a new stream object with appropriate prefix
  * @param boolean Prefix the connections for writing
  * @param boolean Use network if available for writing; use false to disable (e.g. FTP, SCP)
  * @param string UA User agent to use
  * @param boolean User agent masking (prefix Mozilla)
  */
 function &getStream($use_prefix = true, $use_network = true, $ua = null, $uamask = false)
 {
     RokUpdater::import('joomla.filesystem.stream');
     RokUpdater::import('pasamio.pversion');
     jimport('joomla.client.helper');
     // Setup the context; Joomla! UA and overwrite
     $context = array();
     $version = new PVersion();
     // set the UA for HTTP and overwrite for FTP
     $context['http']['user_agent'] = $version->getUserAgent($ua, $uamask);
     $context['ftp']['overwrite'] = true;
     if ($use_prefix) {
         $FTPOptions = JClientHelper::getCredentials('ftp');
         $SCPOptions = JClientHelper::getCredentials('scp');
         if ($FTPOptions['enabled'] == 1 && $use_network) {
             $prefix = 'ftp://' . $FTPOptions['user'] . ':' . $FTPOptions['pass'] . '@' . $FTPOptions['host'];
             $prefix .= $FTPOptions['port'] ? ':' . $FTPOptions['port'] : '';
             $prefix .= $FTPOptions['root'];
         } else {
             if ($SCPOptions['enabled'] == 1 && $use_network) {
                 $prefix = 'ssh2.sftp://' . $SCPOptions['user'] . ':' . $SCPOptions['pass'] . '@' . $SCPOptions['host'];
                 $prefix .= $SCPOptions['port'] ? ':' . $SCPOptions['port'] : '';
                 $prefix .= $SCPOptions['root'];
             } else {
                 $prefix = JPATH_ROOT . DS;
             }
         }
         $retval = new JStream($prefix, JPATH_ROOT, $context);
     } else {
         $retval = new JStream('', '', $context);
     }
     return $retval;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:40,代码来源:pfactory.php

示例7: loadConfiguration

 /**
  * Loads the configuration from the Joomla! global configuration itself. The component's options are loaded into
  * the options key. For example, an option called foobar is accessible as $config->get('options.foobar');
  *
  * @param string  $filePath Ignored
  * @param Phpfunc $phpfunc  Ignored
  *
  * @return  void
  */
 public function loadConfiguration($filePath = null, Phpfunc $phpfunc = null)
 {
     // Get the Joomla! configuration object
     $jConfig = \JFactory::getConfig();
     // Create the basic configuration data
     $data = array('timezone' => $jConfig->get('offset', 'UTC'), 'fs' => array('driver' => 'file'), 'dateformat' => \JText::_('DATE_FORMAT_LC2'), 'base_url' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'live_site' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'cms_url' => \JUri::base(), 'options' => array());
     // Get the Joomla! FTP layer options
     if (!class_exists('JClientHelper')) {
         \JLoader::import('joomla.client.helper');
     }
     $ftpOptions = \JClientHelper::getCredentials('ftp');
     // If the FTP layer is enabled, enable the Hybrid filesystem engine
     if ($ftpOptions['enabled'] == 1) {
         $data['fs'] = array('driver' => 'hybrid', 'host' => $ftpOptions['host'], 'port' => empty($ftpOptions['port']) ? '21' : $ftpOptions['port'], 'directory' => rtrim($ftpOptions['root'], '/\\'), 'ssl' => false, 'passive' => true, 'username' => $ftpOptions['user'], 'password' => $ftpOptions['pass']);
     }
     // Populate the options key with the component configuration
     $db = $this->container->db;
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('element') . " = " . $db->q('com_' . strtolower($this->container->application_name)));
     try {
         $configJson = $db->setQuery($sql)->loadResult();
     } catch (\Exception $e) {
         $configJson = null;
     }
     if (!empty($configJson)) {
         $data['options'] = json_decode($configJson, true);
     }
     // Finally, load the data to the registry class
     $this->data = new \stdClass();
     $this->loadArray($data);
 }
开发者ID:edrdesigner,项目名称:awf,代码行数:39,代码来源:Configuration.php

示例8: translatePath

 function translatePath($file)
 {
     if (empty($file)) {
         return null;
     }
     jimport('joomla.client.ftp');
     // Initialize variables
     jimport('joomla.client.helper');
     $FTPOptions = JClientHelper::getCredentials('ftp');
     if (JD_Ftp::getFtpHandle()) {
         // Translate path for the FTP account and use FTP write buffer to file
         return JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $file), '/');
     }
     return $file;
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:15,代码来源:jd_ftp.php

示例9: saveProfile

 function saveProfile()
 {
     global $mainframe;
     // Initialize some variables
     $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
     $json = JRequest::getVar('json', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post = json_decode($json);
     $profile = JRequest::getCmd('profile');
     $result = array();
     if (!$profile) {
         $result['error'] = JText::_('No Profile name contains space or special chracters.');
         echo json_encode($result);
         exit;
     }
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     $errors = array();
     $file = dirname(dirname(__FILE__)) . DS . 'profiles' . DS . $profile . '.ini';
     $params = new JParameter('');
     if (isset($post)) {
         foreach ($post as $k => $v) {
             $params->set($k, $v);
         }
     }
     $data = $params->toString();
     if (JFile::exists($file)) {
         @chmod($file, 0777);
     }
     $return = @JFile::write($file, $data);
     // Try to make the params file unwriteable
     if (!$ftp['enabled'] && @JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
         $errors[] = sprintf(JText::_('Profile file unwritable'), $file);
     }
     if (!$return) {
         $errors[] = JText::_('Operation Failed') . ': ' . JText::sprintf('Failed to open file for writing.', $file);
     }
     if ($errors) {
         $result['error'] = implode('<br/>', $errors);
     } else {
         $result['successful'] = sprintf(JText::_('SAVE PROFILE SUCCESSFULLY'), $profile);
         $result['profile'] = $profile;
         $result['type'] = 'new';
     }
     echo json_encode($result);
     exit;
 }
开发者ID:skyview059,项目名称:e-learning-website,代码行数:48,代码来源:helper.php

示例10: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     global $mctrl;
     $mctrl =& MissionControl::getInstance();
     if ($mctrl->_getCurrentAdminTemplate() == "rt_missioncontrol_j15") {
         $ftp = JClientHelper::getCredentials('ftp');
         if ($ftp['enabled']) {
             $html = '<div class="mc-update-check"><b>* FTP mode currently not supported in Auto-Update</b><br />Please check the MissionControl forum for information on the latest version.</div>';
         } else {
             $html = MCUpdater::display(false);
         }
     } else {
         $html = '<b>* Feature only available within MissionControl</b>';
     }
     return $html;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:16,代码来源:updatecheck.php

示例11: dgChmod

function dgChmod($dir, $mode = 0755)
{
    static $ftpOptions;
    if (!isset($ftpOptions)) {
        jimport('joomla.client.helper');
        $ftpOptions = JClientHelper::getCredentials('ftp');
    }
    if ($ftpOptions['enabled'] == 1) {
        jimport('joomla.client.ftp');
        $ftp = JFTP::getInstance($ftpOptions['host'], $ftpOptions['port'], null, $ftpOptions['user'], $ftpOptions['pass']);
        $dir = JPath::clean(str_replace(JPATH_ROOT, $ftpOptions['root'], $dir), '/');
        return $ftp->chmod($dir, $mode);
    } else {
        return true;
    }
}
开发者ID:j0rg3m414,项目名称:centerar,代码行数:16,代码来源:images.datsogallery.php

示例12: setDatabaseType

 public function setDatabaseType()
 {
     $path = JPATH_CONFIGURATION . '/configuration.php';
     $result = false;
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     $ftp = JClientHelper::getCredentials('ftp');
     jimport('joomla.filesystem.path');
     if ($ftp['enabled'] || JPath::isOwner($path) && JPath::setPermissions($path, '0644')) {
         $search = JFile::read($path);
         $replaced = str_replace('$dbtype = \'mysql\';', '$dbtype = \'mysqli\';', $search);
         $result = JFile::write($path, $replaced);
         if (!$ftp['enabled'] && JPath::isOwner($path)) {
             JPath::setPermissions($path, '0444');
         }
     }
     return $result;
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:18,代码来源:helper.php

示例13: delete

 function delete(&$id)
 {
     $element = $this->get(reset($id));
     if (!$element) {
         return false;
     }
     jimport('joomla.filesystem.file');
     if (!JFile::exists($element->override)) {
         return true;
     }
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     if (!$ftp['enabled'] && !JPath::setPermissions($element->override, '0755')) {
         JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('FILE_NOT_WRITABLE', $element->override));
     }
     $result = JFile::delete($element->override);
     return $result;
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:19,代码来源:view.php

示例14: savecss

 /**
  * Saves the css
  *
  */
 function savecss()
 {
     global $mainframe;
     JRequest::checkToken() or die('Invalid Token');
     // Initialize some variables
     $option = JRequest::getVar('option');
     $filename = JRequest::getVar('filename', '', 'post', 'cmd');
     $filecontent = JRequest::getVar('filecontent', '', '', '', JREQUEST_ALLOWRAW);
     if (!$filecontent) {
         $mainframe->redirect('index.php?option=' . $option, JText::_('OPERATION FAILED') . ': ' . JText::_('CONTENT EMPTY'));
     }
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     $file = JPATH_SITE . DS . 'components' . DS . 'com_eventlist' . DS . 'assets' . DS . 'css' . DS . $filename;
     // Try to make the css file writeable
     if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) {
         JError::raiseNotice('SOME_ERROR_CODE', 'COULD NOT MAKE CSS FILE WRITABLE');
     }
     jimport('joomla.filesystem.file');
     $return = JFile::write($file, $filecontent);
     // Try to make the css file unwriteable
     if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
         JError::raiseNotice('SOME_ERROR_CODE', 'COULD NOT MAKE CSS FILE UNWRITABLE');
     }
     if ($return) {
         $task = JRequest::getVar('task');
         switch ($task) {
             case 'applycss':
                 $mainframe->redirect('index.php?option=' . $option . '&view=editcss', JText::_('CSS FILE SUCCESSFULLY ALTERED'));
                 break;
             case 'savecss':
             default:
                 $mainframe->redirect('index.php?option=' . $option, JText::_('CSS FILE SUCCESSFULLY ALTERED'));
                 break;
         }
     } else {
         $mainframe->redirect('index.php?option=' . $option, JText::_('OPERATION FAILED') . ': ' . JText::sprintf('FAILED TO OPEN FILE FOR WRITING', $file));
     }
 }
开发者ID:janssit,项目名称:www.kadulleke.be,代码行数:45,代码来源:controller.php

示例15: saveProfile

 /**
  * Save Profile to module folder
  */
 public function saveProfile()
 {
     //This function only run in backend
     $app = JFactory::getApplication();
     if (!$app->isAdmin()) {
         return false;
     }
     //Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     $ftp = JClientHelper::getCredentials('ftp');
     //Do NOT filter, HTML can be saved in profile
     $data_json = JRequest::getVar('data_json', '', 'post', 'string', JREQUEST_ALLOWRAW);
     //Create profile folder if does not exist
     $moduleprofilefolder = JPATH_SITE . DS . 'modules' . DS . $this->modulename . DS . 'profiles';
     if (!is_dir($moduleprofilefolder)) {
         mkdir($moduleprofilefolder);
         //Create blank index.html file
         $fp = fopen($moduleprofilefolder . DS . 'index.html', 'w');
         fwrite($fp, '<!DOCTYPE html><title></title>');
         fclose($fp);
     }
     $file = self::getIniFileModule();
     if (JFile::exists($file)) {
         chmod($file, 0777);
     }
     $data = array();
     if (JFile::write($file, $data_json)) {
         $data['success'] = 1;
         $data['reports'] = JText::_('SAVE_PROFILE_SUCCESSFULLY');
     } else {
         $data['success'] = 0;
         $data['reports'] = JText::_('FILE_UNWRITEABLE');
     }
     // Try to make the params file unwriteable
     if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) {
         $data['success'] = 0;
         $data['reports'] = JText::_('FILE_UNWRITEABLE');
     }
     return $data;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:44,代码来源:juprofile.php


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