0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: install.php.tar
home/academiac/www/administrator/components/com_installer/models/install.php 0000644 00000015723 15137210363 0023562 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_installer * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Extension Manager Install Model * * @package Joomla.Administrator * @subpackage com_installer * @since 1.5 */ class InstallerModelInstall extends JModelLegacy { /** * @var object JTable object */ protected $_table = null; /** * @var object JTable object */ protected $_url = null; /** * Model context string. * * @var string */ protected $_context = 'com_installer.install'; /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState() { // Initialise variables. $app = JFactory::getApplication('administrator'); $this->setState('message', $app->getUserState('com_installer.message')); $this->setState('extension_message', $app->getUserState('com_installer.extension_message')); $app->setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); // Recall the 'Install from Directory' path. $path = $app->getUserStateFromRequest($this->_context.'.install_directory', 'install_directory', $app->getCfg('tmp_path')); $this->setState('install.directory', $path); parent::populateState(); } /** * Install an extension from either folder, url or upload. * * @return boolean result of install * @since 1.5 */ function install() { $this->setState('action', 'install'); // Set FTP credentials, if given. JClientHelper::setCredentialsFromRequest('ftp'); $app = JFactory::getApplication(); switch(JRequest::getWord('installtype')) { case 'folder': // Remember the 'Install from Directory' path. $app->getUserStateFromRequest($this->_context.'.install_directory', 'install_directory'); $package = $this->_getPackageFromFolder(); break; case 'upload': $package = $this->_getPackageFromUpload(); break; case 'url': $package = $this->_getPackageFromUrl(); break; default: $app->setUserState('com_installer.message', JText::_('COM_INSTALLER_NO_INSTALL_TYPE_FOUND')); return false; break; } // Was the package unpacked? if (!$package) { $app->setUserState('com_installer.message', JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE')); return false; } // Get an installer instance $installer = JInstaller::getInstance(); // Install the package if (!$installer->install($package['dir'])) { // There was an error installing the package $msg = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_'.strtoupper($package['type']))); $result = false; } else { // Package installed sucessfully $msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_'.strtoupper($package['type']))); $result = true; } // Set some model state values $app = JFactory::getApplication(); $app->enqueueMessage($msg); $this->setState('name', $installer->get('name')); $this->setState('result', $result); $app->setUserState('com_installer.message', $installer->message); $app->setUserState('com_installer.extension_message', $installer->get('extension_message')); $app->setUserState('com_installer.redirect_url', $installer->get('redirect_url')); // Cleanup the install files if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile']; } JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); return $result; } /** * Works out an installation package from a HTTP upload * * @return package definition or false on failure */ protected function _getPackageFromUpload() { // Get the uploaded file information $userfile = JRequest::getVar('install_package', null, 'files', 'array'); // Make sure that file uploads are enabled in php if (!(bool) ini_get('file_uploads')) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE')); return false; } // Make sure that zlib is loaded so that the package can be unpacked if (!extension_loaded('zlib')) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB')); return false; } // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED')); return false; } // Check if there was a problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR')); return false; } // Build the appropriate paths $config = JFactory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; // Move uploaded file jimport('joomla.filesystem.file'); $uploaded = JFile::upload($tmp_src, $tmp_dest); // Unpack the downloaded package file $package = JInstallerHelper::unpack($tmp_dest); return $package; } /** * Install an extension from a directory * * @return Package details or false on failure * @since 1.5 */ protected function _getPackageFromFolder() { // Get the path to the package to install $p_dir = JRequest::getString('install_directory'); $p_dir = JPath::clean($p_dir); // Did you give us a valid directory? if (!is_dir($p_dir)) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY')); return false; } // Detect the package type $type = JInstallerHelper::detectType($p_dir); // Did you give us a valid package? if (!$type) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE')); return false; } $package['packagefile'] = null; $package['extractdir'] = null; $package['dir'] = $p_dir; $package['type'] = $type; return $package; } /** * Install an extension from a URL * * @return Package details or false on failure * @since 1.5 */ protected function _getPackageFromUrl() { // Get a database connector $db = JFactory::getDbo(); // Get the URL of the package to install $url = JRequest::getString('install_url'); // Did you give us a URL? if (!$url) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL')); return false; } // Download the package at the URL given $p_file = JInstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL')); return false; } $config = JFactory::getConfig(); $tmp_dest = $config->get('tmp_path'); // Unpack the downloaded package file $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file); return $package; } } home/academiac/www/administrator/components/com_installer/controllers/install.php 0000644 00000002420 15137212045 0024632 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_installer * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License, see LICENSE.php */ defined('_JEXEC') or die; /** * @package Joomla.Administrator * @subpackage com_installer */ class InstallerControllerInstall extends JControllerLegacy { /** * Install an extension. * * @return void * @since 1.5 */ public function install() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $model = $this->getModel('install'); if ($model->install()) { $cache = JFactory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits } $app = JFactory::getApplication(); $redirect_url = $app->getUserState('com_installer.redirect_url'); if(empty($redirect_url)) { $redirect_url = JRoute::_('index.php?option=com_installer&view=install', false); } else { // wipe out the user state when we're going to redirect $app->setUserState('com_installer.redirect_url', ''); $app->setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); } $this->setRedirect($redirect_url); } } home/academiac/www/administrator/components/com_unitehcarousel/install.php 0000604 00000005063 15137226457 0023337 0 ustar 00 <?php // No direct access. defined('_JEXEC') or die; class com_unitehcarouselInstallerScript { /** * Constructor * * @param JAdapterInstance $adapter The object responsible for running this script */ public function __constructor(JAdapterInstance $adapter){ } /** * Called before any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function preflight($route, JAdapterInstance $adapter){ } /** * Called after any type of action * * @param string $route Which action is happening (install|uninstall|discover_install) * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function postflight($route, JAdapterInstance $adapter){ } /** * * install the modules from "modules" folder */ public function installModules(JAdapterInstance &$adapter,$type="install"){ $ds = ""; if(defined("DIRECTORY_SEPARATOR")) $ds = DIRECTORY_SEPARATOR; else $ds = DS; $manifest = $adapter->get("manifest"); $installer = new JInstaller(); $p_installer = $adapter->getParent(); // Install modules if (is_object($manifest->modules->module)){ foreach($manifest->modules->module as $module){ $attributes = $module->attributes(); $modulePath = $p_installer->getPath("source") . $ds . $attributes['folder'] . $ds . $attributes['module']; if($type == "install") $installer->install($modulePath); else $installer->update($modulePath); } } } /** * Called on installation * * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function install(JAdapterInstance $adapter){ $this->installModules($adapter,"install"); } /** * Called on update * * @param JAdapterInstance $adapter The object responsible for running this script * * @return boolean True on success */ public function update(JAdapterInstance $adapter){ $this->installModules($adapter,"update"); } /** * Called on uninstallation * * @param JAdapterInstance $adapter The object responsible for running this script */ public function uninstall(JAdapterInstance $adapter){ } } ?>