Example #1
0
 /**
  * Install components
  */
 public function install()
 {
     // Check access
     $user = JFactory::getUser();
     $this->setRedirect(JRoute::_('index.php?option=com_jdeveloper&view=component', false));
     // Check if action is allowed
     if (!$user->authorise('components.install', 'com_jdeveloper')) {
         $this->setMessage(JText::_('COM_JDEVELOPER_ACTION_NOT_ALLOWED'), 'warning');
         return;
     }
     jimport('joomla.filesystem.folder');
     require_once JDeveloperLIB . DS . 'install.php';
     $app = JFactory::getApplication();
     $ids = $app->input->get('cid', array(), 'array');
     // Install components
     foreach ($ids as $id) {
         $component = $this->getModel()->getItem($id);
         $path = $component->createDir . '.zip';
         $this->create(array($id));
         if (JDeveloperInstall::isInstalled('component', 'com_' . $component->name)) {
             JDeveloperInstall::install($path, true);
         } else {
             JDeveloperInstall::install($path);
         }
     }
     $this->setMessage(JText::sprintf('COM_JDEVELOPER_COMPONENT_INSTALLED', count($ids)));
 }
Example #2
0
 /**
  * Install templates
  */
 public function install()
 {
     // Check access
     $user = JFactory::getUser();
     $this->setRedirect(JRoute::_('index.php?option=com_jdeveloper&view=template', false));
     if (!$user->authorise('templates.install', 'com_jdeveloper')) {
         $this->setMessage(JText::_('COM_JDEVELOPER_ACTION_NOT_ALLOWED'), 'warning');
         return;
     }
     // Initialize
     jimport('joomla.filesystem.folder');
     require_once JDeveloperLIB . '/install.php';
     $app = JFactory::getApplication();
     $ids = $app->input->get('cid', array(), 'array');
     // Install templates
     foreach ($ids as $id) {
         $template = $this->getModel()->getItem($id);
         $path = $template->createDir . ".zip";
         $this->create(array($id));
         if (JDeveloperInstall::isInstalled('template', $template->name)) {
             JDeveloperInstall::install($path, true);
         } else {
             JDeveloperInstall::install($path);
         }
     }
     $this->setMessage(JText::sprintf('COM_JDEVELOPER_TEMPLATE_MESSAGE_INSTALLED', count($ids)));
 }
Example #3
0
 /**
  * Install packages
  */
 public function install()
 {
     require_once JDeveloperLIB . DS . 'install.php';
     $this->setRedirect(JRoute::_('index.php?option=com_jdeveloper&view=packages', false));
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if (!$user->authorise('packages.install', 'com_jdeveloper')) {
         $this->setMessage(JText::_('COM_JDEVELOPER_ACTION_NOT_ALLOWED'), 'warning');
         return;
     }
     $files = $app->input->get('cid', array(), 'array');
     foreach ($files as $file) {
         preg_match("/pkg_[A-Za-z_]*/", $file, $matches);
         $path = JDeveloperARCHIVE . "/" . $file;
         JDeveloperInstall::install($path, JDeveloperInstall::isInstalled('package', $matches[0]));
     }
     $this->setMessage(JText::sprintf('COM_JDEVELOPER_PACKAGE_INSTALLATION_SUCCESS', count($files)));
 }