示例#1
0
 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);
 }
示例#2
0
 /**
  * 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();
 }
 /**
  * Execute and display a template script.
  *
  * @param   string $tpl The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  *
  * @since   3.6
  */
 public function display($tpl = null)
 {
     $this->user = JFactory::getUser();
     $this->bar = JToolbar::getInstance('toolbar');
     $ftp = !JClientHelper::hasCredentials('ftp');
     $images = $this->get('images');
     $subfolders = $this->get('folders');
     $folders = $this->getModel()->getFolders(COM_MEDIA_BASE);
     $currentFolder = $this->getModel()->getCurrentFolder();
     $state = $this->get('state');
     $this->session = JFactory::getSession();
     $this->config = JComponentHelper::getParams('com_media');
     $this->state = $this->get('state');
     $this->require_ftp = $ftp;
     $this->images = $images;
     $this->folders = $folders;
     $this->current_folder = $currentFolder;
     $this->subfolders = $subfolders;
     $this->state = $state;
     if ($this->state->folder === "") {
         $this->state->folder = COM_MEDIA_BASEURL;
     }
     // Set the toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
示例#4
0
 /**
  * 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);
 }
示例#5
0
 /**
  * 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;
     }
 }
示例#6
0
 function display($tpl = null)
 {
     $config = JComponentHelper::getParams('com_media');
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $append = '';
     $clave = JRequest::getVar('clave');
     JHtml::_('behavior.framework', true);
     JHtml::_('script', 'media/popup-imagemanager.js', true, true);
     JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true);
     if ($lang->isRTL()) {
         JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true);
     }
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->session = JFactory::getSession();
     $this->config = $config;
     $this->state = $this->get('state');
     $this->folderList = $this->get('folderList');
     $this->require_ftp = $ftp;
     parent::display($tpl);
 }
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']);
    }
}
示例#8
0
 /**
  * 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;
     }
 }
示例#9
0
 function display($tpl = null)
 {
     global $mainframe;
     $config =& JComponentHelper::getParams('com_media');
     $app = JFactory::getApplication();
     $append = '';
     if ($app->getClientId() == 1) {
         $append = 'administrator/';
     }
     JHTML::_('script', 'popup-imagemanager.js', $append . 'components/com_media/assets/');
     JHTML::_('stylesheet', 'popup-imagemanager.css', $append . 'components/com_media/assets/');
     if ($config->get('enable_flash', 1)) {
         JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ ImageManager.refreshFrame(); }'));
     }
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     jimport('joomla.client.helper');
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->assignRef('session', JFactory::getSession());
     $this->assignRef('config', $config);
     $this->assignRef('state', $this->get('state'));
     $this->assignRef('folderList', $this->get('folderList'));
     $this->assign('require_ftp', $ftp);
     parent::display($tpl);
 }
示例#10
0
/**
 * 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'));
    }
}
示例#11
0
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');
    }
}
示例#12
0
 /**
  * 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;
 }
示例#13
0
 /**
  * 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;
 }
示例#14
0
文件: create.php 项目: naka211/jydsk
 /**
  * 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;
                     }
                 }
             }
         }
     }
 }
示例#15
0
 /**
  * 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);
 }
示例#16
0
 /**
  * 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();
 }
示例#17
0
 function display($tpl = null)
 {
     global $mainframe;
     $style = $mainframe->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
     $listStyle = "\n\t\t\t<ul id=\"submenu\">\n\t\t\t\t<li><a id=\"thumbs\" onclick=\"MediaManager.setViewType('thumbs')\">" . JText::_('Thumbnail View') . "</a></li>\n\t\t\t\t<li><a id=\"details\" onclick=\"MediaManager.setViewType('details')\">" . JText::_('Detail View') . "</a></li>\n\t\t\t</ul>\n\t\t";
     $document =& JFactory::getDocument();
     $document->setBuffer($listStyle, 'module', 'submenu');
     JHTML::_('behavior.mootools');
     $document->addScript('components/com_media/assets/mediamanager.js');
     $document->addStyleSheet('components/com_media/assets/mediamanager.css');
     JHTML::_('behavior.modal');
     $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});");
     JHTML::script('mootree.js');
     JHTML::stylesheet('mootree.css');
     JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ MediaManager.refreshFrame(); }'));
     $base = str_replace("\\", "/", JPATH_ROOT);
     $js = "\n\t\t\tvar basepath = '" . $base . '/images' . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t";
     $document->addScriptDeclaration($js);
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     jimport('joomla.client.helper');
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->assignRef('session', JFactory::getSession());
     $this->assignRef('config', JComponentHelper::getParams('com_media'));
     $this->assignRef('state', $this->get('state'));
     $this->assign('require_ftp', $ftp);
     $this->assign('folders_id', ' id="media-tree"');
     $this->assign('folders', $this->get('folderTree'));
     // Set the toolbar
     $this->_setToolBar();
     parent::display($tpl);
     echo JHTML::_('behavior.keepalive');
 }
示例#18
0
 /**
  * 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;
 }
示例#19
0
 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);
 }
示例#20
0
 /**
  * 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;
 }
示例#21
0
 function themeinstall()
 {
     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'])) {
         // TODO - change to 1 in case the parameters component will be added to Joomla! CMS back
         $theme['categories'] = 0;
     }
     if (isset($post['theme_category'])) {
         // TODO - change to 1 in case the parameters component will be added to Joomla! CMS back
         $theme['category'] = 0;
     }
     if (!empty($theme)) {
         $ftp =& JClientHelper::setCredentialsFromRequest('ftp');
         $model =& $this->getModel('phocagalleryt');
         if ($model->install($theme)) {
             $cache =& JFactory::getCache('mod_menu');
             $cache->clean();
             $msg = JText::_('COM_PHOCAGALLERY_SUCCESS_THEME_INSTALLED');
         }
     } else {
         $msg = JText::_('COM_PHOCAGALLERY_ERROR_THEME_APPLICATION_AREA');
     }
     $this->setRedirect('index.php?option=com_phocagallery&view=phocagalleryt', $msg);
 }
示例#22
0
 /**
  * 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();
 }
示例#23
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise an Error object.
  *
  * @since   1.0
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $config = JComponentHelper::getParams('com_media');
     if (!$app->isAdmin()) {
         return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
     }
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     $ftp = !JClientHelper::hasCredentials('ftp');
     $session = JFactory::getSession();
     $state = $this->get('state');
     $this->session = $session;
     $this->config =& $config;
     $this->state =& $state;
     $this->require_ftp = $ftp;
     $this->folders_id = ' id="media-tree"';
     $this->folders = $this->get('folderTree');
     $this->sidebar = JHtmlSidebar::render();
     // Set the toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
示例#24
0
 /**
  * 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);
 }
 /**
  * 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;
 }
示例#26
0
 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;
 }
示例#27
0
 /**
  * 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;
 }
示例#28
0
 /**
  * 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);
 }
示例#29
0
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $config =& JComponentHelper::getParams('com_media');
     $style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
     $document =& JFactory::getDocument();
     $document->setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu');
     JHtml::_('behavior.framework', true);
     $document->addScript('../media/media/js/mediamanager.js');
     $document->addStyleSheet('../media/media/css/mediamanager.css');
     JHtml::_('behavior.modal');
     $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});");
     JHtml::script('mootree.js');
     JHtml::stylesheet('mootree.css');
     if ($config->get('enable_flash', 1)) {
         $fileTypes = $config->get('image_extensions', 'bmp,gif,jpg,png,jpeg');
         $types = explode(',', $fileTypes);
         $displayTypes = '';
         // this is what the user sees
         $filterTypes = '';
         // this is what controls the logic
         $firstType = true;
         foreach ($types as $type) {
             if (!$firstType) {
                 $displayTypes .= ', ';
                 $filterTypes .= '; ';
             } else {
                 $firstType = false;
             }
             $displayTypes .= '*.' . $type;
             $filterTypes .= '*.' . $type;
         }
         $typeString = '{ \'Images (' . $displayTypes . ')\': \'' . $filterTypes . '\' }';
         JHtml::_('behavior.uploader', 'upload-flash', array('onComplete' => 'function(){ MediaManager.refreshFrame(); }', 'targetURL' => '\\$(\'uploadForm\').action', 'typeFilter' => $typeString));
     }
     if (DS == '\\') {
         $base = str_replace(DS, "\\\\", COM_MEDIA_BASE);
     } else {
         $base = COM_MEDIA_BASE;
     }
     $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t";
     $document->addScriptDeclaration($js);
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     jimport('joomla.client.helper');
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->assignRef('session', JFactory::getSession());
     $this->assignRef('config', $config);
     $this->assignRef('state', $this->get('state'));
     $this->assign('require_ftp', $ftp);
     $this->assign('folders_id', ' id="media-tree"');
     $this->assign('folders', $this->get('folderTree'));
     // Set the toolbar
     $this->_setToolBar();
     parent::display($tpl);
     echo JHtml::_('behavior.keepalive');
 }
示例#30
0
 function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $config = JComponentHelper::getParams(JACOMPONENT);
     $lang = JFactory::getLanguage();
     //$style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'details', 'word');
     $style = "details";
     JHtml::_('behavior.framework', true);
     $assets = JURI::root() . 'administrator/components/com_jaextmanager/assets/';
     $document = JFactory::getDocument();
     if (jaIsJoomla3x()) {
         $document->setBuffer($this->loadTemplate('navigation'), 'modules', 'top');
         JHtml::_('script', $assets . 'repo_manager_3/' . 'repomanager.js', false, true);
         JHtml::_('stylesheet', $assets . 'repo_manager_3/' . 'repomanager.css', false, true);
     } else {
         $document->setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu');
         JHtml::_('script', $assets . 'repo_manager/' . 'repomanager.js', false, true);
         JHtml::_('stylesheet', $assets . 'repo_manager/' . 'repomanager.css', false, true);
     }
     JHtml::_('behavior.modal', 'a.modal');
     $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\tdocument.preview = SqueezeBox;\n\t\t});");
     JHtml::_('script', 'system/mootree.js', true, true, false, false);
     JHtml::_('stylesheet', 'system/mootree.css', array(), true);
     if ($lang->isRTL()) {
         JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true);
     }
     if ($config->get('enable_flash', 0)) {
         JHtml::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ MediaManager.refreshFrame(); }'));
     }
     if (DS == '\\') {
         $base = str_replace(DS, "\\\\", JA_WORKING_DATA_FOLDER);
     } else {
         $base = JA_WORKING_DATA_FOLDER;
     }
     $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t";
     $document->addScriptDeclaration($js);
     /*
      * Display form for FTP credentials?
      * Don't set them here, as there are other functions called before this one if there is any file write operation
      */
     jimport('joomla.client.helper');
     $ftp = !JClientHelper::hasCredentials('ftp');
     $session = JFactory::getSession();
     $state = $this->get('state');
     $folderTree = $this->get('folderTree');
     $this->assignRef('session', $session);
     $this->assignRef('config', $config);
     $this->assignRef('state', $state);
     $this->assign('require_ftp', $ftp);
     $this->assign('folders_id', ' id="media-tree"');
     $this->assign('folders', $folderTree);
     // Set the toolbar
     $this->addToolbar();
     parent::display($tpl);
     echo JHtml::_('behavior.keepalive');
 }