function installHotelPackages()
{
    jimport('joomla.installer.installer');
    // Install Package Manager
    $basedir = dirname(__FILE__);
    $packageDir = JPATH_ADMINISTRATOR . '/components/com_jhotelreservation/extensions';
    if (!is_dir($packageDir)) {
        $packageDir = $basedir . '/admin/extensions';
    }
    $extensionsDirs = JFolder::folders($packageDir);
    foreach ($extensionsDirs as $extensionDir) {
        $tmpInstaller = new JInstaller();
        if (!$tmpInstaller->update($packageDir . '/' . $extensionDir)) {
            JError::raiseWarning(100, "Extension :" . $extensionDir);
        }
    }
    $db = JFactory::getDBO();
    $db->setQuery(" UPDATE #__extensions SET enabled=1 WHERE name='Hotel Url Translator' ");
    $db->query();
    $db = JFactory::getDBO();
    $db->setQuery(" UPDATE #__extensions SET enabled=1 WHERE name='Hotel Gallery' ");
    $db->query();
    $path = JPATH_ADMINISTRATOR . '/components/com_jhotelreservation/help/readme.html';
    ?>
		
		<div style="text-align: left; float: left;">
		<?php 
    include $path;
    ?>
		</div>
<?php 
}
Exemplo n.º 2
0
 /**
  * 
  * 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);
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Installs plugins for this component
  *
  * @param   mixed $parent Object who called the install/update method
  *
  * @return void
  */
 private function installModules($parent)
 {
     $installation_folder = $parent->getParent()->getPath('source');
     $app = JFactory::getApplication();
     if (!empty($parent->get("manifest")->modules)) {
         $modules = $parent->get("manifest")->modules;
         if (count($modules->children())) {
             foreach ($modules->children() as $module) {
                 $moduleName = (string) $module['module'];
                 $path = $installation_folder . '/modules/' . $moduleName;
                 $installer = new JInstaller();
                 if (!$this->isAlreadyInstalled('module', $moduleName)) {
                     $result = $installer->install($path);
                 } else {
                     $result = $installer->update($path);
                 }
                 if ($result) {
                     $app->enqueueMessage('Module ' . $moduleName . ' was installed successfully');
                 } else {
                     $app->enqueueMessage('There was an issue installing the module ' . $moduleName, 'error');
                 }
             }
         }
     }
 }
 public function update($parent)
 {
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     $status = new stdClass();
     $status->modules = array();
     $status->plugins = array();
     $db = JFactory::getDBO();
     $src = $parent->getParent()->getPath('source');
     $manifest = $parent->getParent()->manifest;
     $isUpdate = JFile::exists(JPATH_SITE . DS . 'modules' . DS . 'mod_socialloginandsocialshare' . DS . 'mod_socialloginandsocialshare.php');
     // create a folder inside your images folder
     JFolder::create(JPATH_ROOT . DS . 'images' . DS . 'sociallogin');
     // Load sociallogin language file
     $lang = JFactory::getLanguage();
     $lang->load('com_socialloginandsocialshare', JPATH_SITE);
     // Installing modules.
     $modules = $manifest->xpath('modules/module');
     foreach ($modules as $module) {
         $mod_data = array();
         foreach ($module->attributes() as $key => $value) {
             $mod_data[$key] = strval($value);
         }
         $mod_data['client'] = JApplicationHelper::getClientInfo($mod_data['client'], true);
         if (is_null($mod_data['client']->name)) {
             $client = 'site';
         }
         $path = $src . DS . $mod_data['module'];
         $installer = new JInstaller();
         $result = $installer->update($path);
         if ($result) {
             $status->modules[] = array('name' => $mod_data['module'], 'client' => $mod_data['client']->name, 'result' => $result);
         }
     }
     if (!$isUpdate) {
         $query = "UPDATE #__modules SET title = '" . $mod_data['title'] . "', position='" . $mod_data['position'] . "', ordering='" . $mod_data['order'] . "', published = 1, access=1 WHERE module='" . $mod_data['module'] . "'";
         $db->setQuery($query);
         $db->execute();
     }
     $query = 'SELECT `id` FROM `#__modules` WHERE module = ' . $db->Quote($mod_data['module']);
     $db->setQuery($query);
     if (!$db->execute()) {
         $parent->getParent()->abort(JText::_('Module') . ' ' . JText::_('Install') . ': ' . $db->stderr(true));
         return false;
     }
     $mod_id = $db->loadResult();
     if ((int) $mod_data['client']->id == 0) {
         $query = 'REPLACE INTO `#__modules_menu` (moduleid,menuid) values (' . $db->Quote($mod_id) . ',0)';
         $db->setQuery($query);
         if (!$db->execute()) {
             // Install failed, roll back changes
             $parent->getParent()->abort(JText::_('Module') . ' ' . JText::_('Install') . ': ' . $db->stderr(true));
             return false;
         }
     }
     // Installing plugins.
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $plg_data = array();
         foreach ($plugin->attributes() as $key => $value) {
             $plg_data[$key] = strval($value);
         }
         $path = $src . DS . 'plg_' . $plg_data['plugin'];
         $installer = new JInstaller();
         $result = $installer->update($path);
         if ($result) {
             $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($plg_data['plugin']) . " AND folder=" . $db->Quote($plg_data['group']);
             $db->setQuery($query);
             $db->execute();
         }
         // Plugin Installed
         $status->plugins[] = array('name' => $plg_data['plugin'], 'group' => $plg_data['group']);
         $query = "SELECT `extension_id` FROM `#__extensions` WHERE type='plugin' AND element=" . $db->Quote($plg_data['plugin']) . " AND folder=" . $db->Quote($plg_data['group']);
         $db->setQuery($query);
         if (!$db->execute()) {
             $parent->getParent()->abort(JText::_('Plugin') . ' ' . JText::_('Update') . ': ' . $db->stderr(true));
             return false;
         }
     }
     $this->installationResults($status);
 }
Exemplo n.º 5
0
 function _installPlugins($manifest, $source, $upgrade = false)
 {
     $installer = new JInstaller();
     $plugin_names = array();
     // Install plugins
     foreach ($manifest->plugins->plugin as $plugin) {
         $attributes = $plugin->attributes();
         $plg = $source . DS . $attributes['folder'] . DS . $attributes['plugin'];
         if ($upgrade) {
             $installer->update($plg);
         } else {
             $installer->install($plg);
         }
         $plugin_names[] = $attributes['plugin'];
     }
     return $plugin_names;
 }