本文整理汇总了PHP中JClientHelper::setCredentialsFromRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP JClientHelper::setCredentialsFromRequest方法的具体用法?PHP JClientHelper::setCredentialsFromRequest怎么用?PHP JClientHelper::setCredentialsFromRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JClientHelper
的用法示例。
在下文中一共展示了JClientHelper::setCredentialsFromRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php';
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'install');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default', 'string');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->ftp =& $ftp;
// Get the model for the view.
$model = $this->getModel($vName);
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
// Load the submenu.
InstallerHelper::addSubmenu($vName);
$view->display();
}
return $this;
}
示例2: themeinstall
function themeinstall()
{
// Check for request forgeries
JRequest::checkToken() or die('Invalid Token');
$post = JRequest::get('post');
$theme = array();
if (isset($post['theme_component'])) {
$theme['component'] = 1;
}
if (isset($post['theme_categories'])) {
$theme['categories'] = 1;
}
if (isset($post['theme_category'])) {
$theme['category'] = 1;
}
if (!empty($theme)) {
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$model =& $this->getModel('phocagalleryt');
if ($model->install($theme)) {
$cache =& JFactory::getCache('mod_menu');
$cache->clean();
$msg = JText::_('New Theme Installed');
}
} else {
$msg = JText::_('Select Application Area');
}
$this->setRedirect('index.php?option=com_phocagallery&view=phocagalleryt', $msg);
}
示例3: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/installer.php';
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = JRequest::getCmd('view', 'install');
$vFormat = $document->getType();
$lName = JRequest::getCmd('layout', 'default');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
// Get the model for the view.
$model = $this->getModel($vName);
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->assignRef('document', $document);
// Load the submenu.
InstallerHelper::addSubmenu($vName);
$view->display();
}
return $this;
}
示例4: display
/**
* Method to display the view.
*/
public function display($tpl = null)
{
$form = $this->get('Form');
$data = $this->get('Data');
// Check for model errors.
if ($errors = $this->get('Errors')) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Bind the form to the data.
if ($form && $data) {
$form->bind($data);
}
// Get the params for com_users.
$usersParams = JComponentHelper::getParams('com_users');
// Get the params for com_media.
$mediaParams = JComponentHelper::getParams('com_media');
// Load settings for the FTP layer.
jimport('joomla.client.helper');
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$this->assignRef('form', $form);
$this->assignRef('data', $data);
$this->assignRef('ftp', $ftp);
$this->assignRef('usersParams', $usersParams);
$this->assignRef('mediaParams', $mediaParams);
$this->addToolbar();
parent::display($tpl);
}
示例5: upload
/**
* Upload a file
* @param string $source File to upload
* @param string $destination Upload to here
* @return True on success
*/
public static function upload($source, $destination)
{
$err = null;
$ret = false;
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Load configurations.
$config = CFactory::getConfig();
// Make the filename safe
jimport('joomla.filesystem.file');
if (!isset($source['name'])) {
JError::raiseNotice(100, JText::_('COM_COMMUNITY_INVALID_FILE_REQUEST'));
return $ret;
}
$source['name'] = JFile::makeSafe($source['name']);
if (is_dir($destination)) {
jimport('joomla.filesystem.folder');
JFolder::create($destination, (int) octdec($config->get('folderpermissionsvideo')));
JFile::copy(JPATH_ROOT . '/components/com_community/index.html', $destination . '/index.html');
$destination = JPath::clean($destination . '/' . strtolower($source['name']));
}
if (JFile::exists($destination)) {
JError::raiseNotice(100, JText::_('COM_COMMUNITY_FILE_EXISTS'));
return $ret;
}
if (!JFile::upload($source['tmp_name'], $destination)) {
JError::raiseWarning(100, JText::_('COM_COMMUNITY_UNABLE_TO_UPLOAD_FILE'));
return $ret;
} else {
$ret = true;
return $ret;
}
}
示例6: displayTask
/**
* Display a list of uninstalled extensions
*
* @return void
*/
public function displayTask()
{
$model = new Models\Manage();
$this->view->state = $model->getState();
$this->view->items = $model->getItems();
$this->view->pagination = $model->getPagination();
$this->view->form = $model->getForm();
// Check for errors.
if (count($errors = $model->getErrors())) {
App::abort(500, implode("\n", $errors));
}
//Check if there are no matching items
if (!count($this->view->items)) {
Notify::warning(Lang::txt('COM_INSTALLER_MSG_MANAGE_NOEXTENSION'));
}
$this->view->ftp = \JClientHelper::setCredentialsFromRequest('ftp');
$showMessage = false;
if (is_object($this->view->state)) {
$message1 = $this->view->state->get('message');
$message2 = $this->view->state->get('extension_message');
$showMessage = $message1 || $message2;
}
$this->view->showMessage = $showMessage;
// Include the component HTML helpers.
Html::addIncludePath(dirname(__DIR__) . '/helpers/html');
$this->view->display();
}
示例7: display
public function display($tpl = null)
{
JToolBarHelper::title(JText::_('Template Manager'), 'thememanager');
JToolBarHelper::custom('edit', 'back.png', 'back_f2.png', 'Back', false, false);
require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'templates.php';
// Initialise some variables
$option = JRequest::getCmd('option');
$id = JRequest::getVar('id', '', 'method', 'int');
$template = TemplatesHelper::getTemplateName($id);
$client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
$tp = true;
$url = $client->id ? JURI::base() : JURI::root();
if (!$template) {
return JError::raiseWarning(500, JText::_('Template not specified'));
}
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
$this->assignRef('option', $option);
$this->assignRef('client', $client);
$this->assignRef('id', $id);
$this->assignRef('template', $template);
$this->assignRef('tp', $tp);
$this->assignRef('url', $url);
parent::display($tpl);
}
示例8: delete
/**
* Method to delete the images
*
* @access public
* @return int
*/
public function delete($type)
{
// Set FTP credentials, if given
jimport('joomla.client.helper');
JClientHelper::setCredentialsFromRequest('ftp');
// Get some data from the request
$images = $this->getImages($type);
$folder = $this->map[$type]['folder'];
$count = count($images);
$fail = 0;
if ($count) {
foreach ($images as $image) {
if ($image !== JFilterInput::getInstance()->clean($image, 'path')) {
JError::raiseWarning(100, JText::_('COM_JEM_HOUSEKEEPING_UNABLE_TO_DELETE') . ' ' . htmlspecialchars($image, ENT_COMPAT, 'UTF-8'));
$fail++;
continue;
}
$fullPath = JPath::clean(JPATH_SITE . '/images/jem/' . $folder . '/' . $image);
$fullPaththumb = JPath::clean(JPATH_SITE . '/images/jem/' . $folder . '/small/' . $image);
if (is_file($fullPath)) {
JFile::delete($fullPath);
if (JFile::exists($fullPaththumb)) {
JFile::delete($fullPaththumb);
}
}
}
}
$deleted = $count - $fail;
return $deleted;
}
示例9: displayTask
/**
* Display a list of uninstalled extensions
*
* @return void
*/
public function displayTask()
{
$model = new Models\Database();
// Get data from the model
$this->view->state = $model->getState();
$this->view->changeSet = $model->getItems();
$this->view->errors = $this->view->changeSet->check();
$this->view->results = $this->view->changeSet->getStatus();
$this->view->schemaVersion = $this->getSchemaVersion();
$this->view->updateVersion = $this->getUpdateVersion();
$this->view->filterParams = $this->getDefaultTextFilters();
$this->view->schemaVersion = $this->view->schemaVersion ? $this->view->schemaVersion : Lang::txt('JNONE');
$this->view->updateVersion = $this->view->updateVersion ? $this->view->updateVersion : Lang::txt('JNONE');
$this->view->pagination = $model->getPagination();
$this->view->errorCount = count($this->errors);
$errors = count($this->view->errors);
if ($this->view->schemaVersion != $this->view->changeSet->getSchema()) {
$this->view->errorCount++;
}
if (!$this->view->filterParams) {
$this->view->errorCount++;
}
if (version_compare($this->view->updateVersion, JVERSION) != 0) {
$this->view->errorCount++;
}
$this->view->ftp = \JClientHelper::setCredentialsFromRequest('ftp');
$showMessage = false;
if (is_object($this->view->state)) {
$message1 = $this->view->state->get('message');
$message2 = $this->view->state->get('extension_message');
$showMessage = $message1 || $message2;
}
$this->view->showMessage = $showMessage;
$this->view->display();
}
示例10: render
/**
* Method to display the view.
*
* @return string The rendered view.
*
* @since 3.2
*/
public function render()
{
$form = null;
$data = null;
try {
// Load Form and Data
$form = $this->model->getForm();
$data = $this->model->getData();
$user = JFactory::getUser();
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
return false;
}
// Bind data
if ($form && $data) {
$form->bind($data);
}
// Get the params for com_users.
$usersParams = JComponentHelper::getParams('com_users');
// Get the params for com_media.
$mediaParams = JComponentHelper::getParams('com_media');
// Load settings for the FTP layer.
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$this->form =& $form;
$this->data =& $data;
$this->ftp =& $ftp;
$this->usersParams =& $usersParams;
$this->mediaParams =& $mediaParams;
$this->components = ConfigHelperConfig::getComponentsWithConfig();
ConfigHelperConfig::loadLanguageForComponents($this->components);
$this->userIsSuperAdmin = $user->authorise('core.admin');
$this->addToolbar();
return parent::render();
}
示例11: create
/**
* create
*
* Creates and then Installs a Molajo Extension as per user instructions
*
* Note: was not able to use the create controller - the form submit of create.create did not find the folder/file
* Change the task to create and added the create method to the display controller
* JLoader::register('InstallerControllerCreate', MOLAJO_LIBRARY_COM_JFOOBARER.'/controllers/create.php');
* require_once MOLAJO_LIBRARY_COM_JFOOBARER.'/controllers/create.php';
*
* @return boolean result of install
*/
function create()
{
/** set ftp credentials, if used **/
JClientHelper::setCredentialsFromRequest('ftp');
/** component */
if ($this->getState('create.createtype') == 'component') {
return $this->_createComponent();
} else {
if ($this->getState('create.createtype') == 'module') {
return $this->_createModule();
} else {
if ($this->getState('create.createtype') == 'plugin') {
return $this->_createPlugin();
} else {
if ($this->getState('create.createtype') == 'layout') {
return $this->_createLayout();
} else {
if ($this->getState('create.createtype') == 'template') {
return $this->_createTemplate();
} else {
JFactory::getApplication()->enqueueMessage(JText::_('PLG_SYSTEM_CREATE_INVALID_EXTENSION_TYPE_FAILED') . ': ' . $this->getState('create.createtype'), 'error');
return false;
}
}
}
}
}
}
示例12: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 2.5.4
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = JRequest::getCmd('view', 'default');
$vFormat = $document->getType();
$lName = JRequest::getCmd('layout', 'default');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
// Get the model for the view.
$model = $this->getModel($vName);
// Perform update source preference check and refresh update information
$model->applyUpdateSite();
$model->refreshUpdates();
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->assignRef('document', $document);
$view->display();
}
return $this;
}
示例13: display
/**
* Display the view
*/
public function display($tpl = null)
{
JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css');
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->ftp = JClientHelper::setCredentialsFromRequest('ftp');
$this->tmpl = new StdClass();
$model = $this->getModel();
// Set CSS for codemirror
JFactory::getApplication()->setUserState('editor.source.syntax', 'css');
// New or edit
if (!$this->form->getValue('id') || $this->form->getValue('id') == 0) {
$this->form->setValue('source', null, '');
$this->form->setValue('type', null, 2);
$this->tmpl->suffixtype = JText::_('COM_PHOCAGALERY_WILL_BE_CREATED_FROM_TITLE');
} else {
$this->source = $model->getSource($this->form->getValue('id'), $this->form->getValue('filename'), $this->form->getValue('type'));
$this->form->setValue('source', null, $this->source->source);
$this->tmpl->suffixtype = '';
}
// Only help input form field - to display Main instead of 1 and Custom instead of 2
if ($this->form->getValue('type') == 1) {
$this->form->setValue('typeoutput', null, JText::_('COM_PHOCAGALLERY_MAIN_CSS'));
} else {
$this->form->setValue('typeoutput', null, JText::_('COM_PHOCAGALLERY_CUSTOM_CSS'));
}
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
parent::display($tpl);
}
示例14: display
/**
* Method to display the view.
*/
public function display($tpl = null)
{
$form = $this->get('Form');
$data = $this->get('Data');
$user = JFactory::getUser();
// Check for model errors.
if ($errors = $this->get('Errors')) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Bind the form to the data.
if ($form && $data) {
$form->bind($data);
}
// Get the params for com_users.
$usersParams = JComponentHelper::getParams('com_users');
// Get the params for com_media.
$mediaParams = JComponentHelper::getParams('com_media');
// Load settings for the FTP layer.
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$this->form =& $form;
$this->data =& $data;
$this->ftp =& $ftp;
$this->usersParams =& $usersParams;
$this->mediaParams =& $mediaParams;
$this->components = ConfigHelperComponent::getComponentsWithConfig();
ConfigHelperComponent::loadLanguageForComponents($this->components);
$this->userIsSuperAdmin = $user->authorise('core.admin');
$this->addToolbar();
parent::display($tpl);
}
示例15: display
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached.
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 2.5.4
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'default');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default', 'string');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat)) {
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->ftp =& $ftp;
// Get the model for the view.
/** @var JoomlaupdateModelDefault $model */
$model = $this->getModel('default');
// Push the Installer Warnings model into the view, if we can load it
static::addModelPath(JPATH_ADMINISTRATOR . '/components/com_installer/models', 'InstallerModel');
$warningsModel = $this->getModel('warnings', 'InstallerModel');
if (is_object($warningsModel)) {
$view->setModel($warningsModel, false);
}
// Perform update source preference check and refresh update information.
$model->applyUpdateSite();
$model->refreshUpdates();
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
$view->display();
}
return $this;
}