function display($tpl = null) { wfimport('admin.models.updates'); $mainframe = JFactory::getApplication(); $model = $this->getModel(); $installer = WFInstaller::getInstance(); $version = $model->getVersion(); // Check Groups DB if (!$installer->profiles) { $link = JHTML::link('index.php?option=com_jce&task=repair&table=profiles', WFText::_('WF_DB_CREATE_RESTORE')); $mainframe->enqueueMessage(WFText::_('WF_DB_PROFILES_ERROR') . ' - ' . $link, 'error'); } $component = WFExtensionHelper::getComponent(); // get params definitions $params = new WFParameter($component->params, '', 'preferences'); $canUpdate = WFModelUpdates::canUpdate(); $options = array('feed' => (int) $params->get('feed', 0), 'updates' => (int) $params->get('updates', $canUpdate ? 1 : 0), 'labels' => array('feed' => WFText::_('WF_CPANEL_FEED_LOAD'), 'updates' => WFText::_('WF_UPDATES'), 'updates_available' => WFText::_('WF_UPDATES_AVAILABLE'))); $this->document->addScript('components/com_jce/media/js/cpanel.js?version=' . $model->getVersion()); $this->document->addScriptDeclaration('jQuery(document).ready(function($){$.jce.CPanel.init(' . json_encode($options) . ')});'); WFToolbarHelper::preferences(); WFToolbarHelper::updates($canUpdate); WFToolbarHelper::help('cpanel.about'); $this->assignRef('icons', $icons); $this->assignRef('model', $model); $this->assignRef('installer', $installer); $this->assignRef('params', $params); $this->assignRef('version', $version); parent::display($tpl); }
public function remove($id, $type) { $app = JFactory::getApplication(); // Use Joomla! Installer class for related extensions if ($type == 'related') { jimport('joomla.installer.installer'); $installer = JInstaller::getInstance(); $result = $installer->uninstall('plugin', $id); } else { $installer = WFInstaller::getInstance(); $installer->setAdapter($type); $result = $installer->uninstall($type, $id); } if (!$result) { $app->enqueueMessage(WFText::sprintf('WF_INSTALLER_UNINSTALL_ERROR'), 'error'); } else { $app->enqueueMessage(WFText::sprintf('WF_INSTALLER_UNINSTALL_SUCCESS')); } $this->_result[] = array('name' => $installer->get('name'), 'type' => $type, 'version' => $installer->get('version'), 'result' => $result); $this->setState('name', WFText::_($installer->get('name'))); $this->setState('result', $result); $this->setState('install.result', $this->_result); return $result; }
/** * Install extension update * @return String JSON string */ public function install() { jimport('joomla.installer.installer'); jimport('joomla.installer.helper'); jimport('joomla.filesystem.file'); $app = JFactory::getApplication(); $result = array('error' => WFText::_('WF_UPDATES_INSTALL_ERROR')); // get vars $file = JRequest::getCmd('file'); $hash = JRequest::getVar('hash', '', 'POST', 'alnum'); $method = JRequest::getWord('installer'); $type = JRequest::getWord('type'); // check for vars if ($file && $hash && $method) { $path = $app->getCfg('tmp_path') . '/' . $file; // check if file exists if (JFile::exists($path)) { // check hash if ($hash == md5(md5_file($path))) { $package = self::unpack($path); if ($package) { // Install a JCE Add-on if ($method == 'jce') { wfimport('admin.classes.installer'); $installer = WFInstaller::getInstance(); // install if ($installer->install($package['dir'])) { // installer message $result = array('error' => '', 'text' => WFText::_($installer->get('message'), $installer->get('message'))); } // Install a Joomla! Extension } else { jimport('joomla.installer.installer'); // get new Installer instance $installer = JInstaller::getInstance(); if ($installer->install($package['dir'])) { // installer message $result = array('error' => '', 'text' => WFText::_($installer->get('message'), $installer->get('message'))); } } // Cleanup the install files JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); } else { $result = array('error' => WFText::_('WF_UPDATES_ERROR_FILE_EXTRACT_FAIL')); JFile::delete($path); } } else { $result = array('error' => WFText::_('WF_UPDATES_ERROR_FILE_VERIFICATION_FAIL')); } } else { $result = array('error' => WFText::_('WF_UPDATES_ERROR_FILE_MISSING_OR_INVALID')); } } return json_encode($result); }
public function repair() { $installer = WFInstaller::getInstance(); $installer->repair(); }
public static function uninstall() { $installer = WFInstaller::getInstance(); $installer->uninstall(); }
// Require the base controller require_once dirname(__FILE__) . DS . 'controller.php'; // Load controller $controllerPath = dirname(__FILE__) . DS . 'controller' . DS . $view . '.php'; if (file_exists($controllerPath)) { require_once $controllerPath; $controllerClass = 'WFController' . ucfirst($view); $controller = new $controllerClass(array('base_path' => dirname(__FILE__))); // load default controller } else { $controller = new WFController(array('base_path' => dirname(__FILE__))); } // check Authorisations switch ($view) { case 'editor': case 'help': case 'popup': break; default: if ($view == 'cpanel') { $view = 'manage'; } // Authorise $controller->authorize($view); $installer = WFInstaller::getInstance(); $installer->check(); break; } // Perform the Request task $controller->execute($task); $controller->redirect();