public function install($path = null)
 {
     $result = parent::install($path);
     $type = (string) $this->manifest->attributes()->type;
     $this->installtype = $this->_adapters[$type]->getInstallType();
     return $result;
 }
Example #2
0
 function postflight($type, $parent)
 {
     $db = JFactory::getDBO();
     $mod_sp_poll = $parent->getParent()->getPath('source') . '/mod_sp_poll';
     $installer = new JInstaller();
     $installer->install($mod_sp_poll);
 }
Example #3
0
        function install()
        {
            $pkg_path = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $this->com . DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR;
            if (JFolder::exists($pkg_path . 'nextend')) {
                $librariesPath = defined('JPATH_LIBRARIES') ? JPATH_LIBRARIES : JPATH_PLATFORM;
                JFolder::copy($pkg_path . 'nextend', $librariesPath . DIRECTORY_SEPARATOR . 'nextend', '', true);
                JFolder::delete($pkg_path . 'nextend');
            }
            $extensions = array_merge(JFolder::folders($pkg_path, '^(?!com_)\\w+$'), JFolder::folders($pkg_path, '^com_\\w+$'));
            if (version_compare(JVERSION, '3.0.0', 'ge')) {
                foreach ($extensions as $pkg) {
                    $f = $pkg_path . DIRECTORY_SEPARATOR . $pkg;
                    $xmlfiles = JFolder::files($f, '.xml$', 1, true);
                    foreach ($xmlfiles as $xmlf) {
                        $file = file_get_contents($xmlf);
                        file_put_contents($xmlf, preg_replace("/<\\/install/", "</extension", preg_replace("/<install/", "<extension", $file)));
                    }
                }
            }
            foreach ($extensions as $pkg) {
                $installer = new JInstaller();
                $installer->setOverwrite(true);
                if ($success = $installer->install($pkg_path . DIRECTORY_SEPARATOR . $pkg)) {
                    $msgcolor = "#E0FFE0";
                    $name = version_compare(JVERSION, '1.6.0', 'l') ? $installer->getManifest()->document->name[0]->data() : $installer->getManifest()->name;
                    $msgtext = $name . " successfully installed.";
                } else {
                    $msgcolor = "#FFD0D0";
                    $msgtext = "ERROR: Could not install the {$pkg}. Please contact us on our support page: http://www.nextendweb.com/help/support";
                }
                ?>
        <table bgcolor="<?php 
                echo $msgcolor;
                ?>
" width ="100%">
          <tr style="height:30px">
            <td><font size="2"><b><?php 
                echo $msgtext;
                ?>
</b></font></td>
          </tr>
        </table><?php 
                if ($success && file_exists("{$pkg_path}/{$pkg}/install.php")) {
                    require_once "{$pkg_path}/{$pkg}/install.php";
                    $com = new $pkg();
                    $com->install();
                }
            }
            $db = JFactory::getDBO();
            if (version_compare(JVERSION, '1.6.0', 'lt')) {
                $db->setQuery("UPDATE #__plugins SET published=1 WHERE name LIKE '%nextend%'");
            } else {
                $db->setQuery("UPDATE #__extensions SET enabled=1 WHERE name LIKE '%nextend%' AND type='plugin'");
            }
            $db->query();
            if (JFolder::exists(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR)) {
                JFolder::delete(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR);
                JFolder::create(JPATH_SITE . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'dojo' . DIRECTORY_SEPARATOR);
            }
        }
Example #4
0
 function postflight($type, $parent)
 {
     $db = JFactory::getDBO();
     $src = $parent->getParent()->getPath('source');
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $path = $src . '/plugins/' . $group;
         if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
             $path = $src . '/plugins/' . $group . '/' . $name;
         }
         $installer = new JInstaller();
         $installer->install($path);
         $query = $db->getQuery(true);
         $query->update($db->quoteName('#__extensions'));
         $query->set($db->quoteName('enabled') . ' = 1');
         $query->where($db->quoteName('type') . ' = ' . $db->Quote('plugin'));
         $query->where($db->quoteName('element') . ' = ' . $db->Quote($name));
         $query->where($db->quoteName('folder') . ' = ' . $db->Quote($group));
         $db->setQuery($query);
         $db->execute();
     }
     $deprecatedFiles = array(JPATH_SITE . '/components/com_proofreader/controllers/typo.raw.php');
     foreach ($deprecatedFiles as $file) {
         if (is_file($file)) {
             JFile::delete($file);
         }
     }
     self::displayDonation();
 }
Example #5
0
 private function installGiantExtensionsPlugin()
 {
     $pluginPath = dirname(__FILE__) . '/plg_content_giantcontent.zip';
     $installResult = JInstallerHelper::unpack($pluginPath);
     if (empty($installResult)) {
         $app = JFactory::getApplication();
         $app->enqueueMessage('Giant Content can not install "Content - Giant Content" plugin. Please install plugin manually inside package.', 'error');
         return false;
     }
     $installer = new JInstaller();
     $installer->setOverwrite(true);
     if (!$installer->install($installResult['extractdir'])) {
         $app = JFactory::getApplication();
         $app->enqueueMessage('Giant Content can not install "Content - Giant Content" plugin. Please install plugin manually inside package.', 'error');
         return false;
     }
     $db = JFactory::getDBO();
     $db->setQuery('UPDATE #__extensions SET enabled = 1 WHERE type = "plugin" AND folder = "content" AND element = "giantcontent"');
     $db->query();
     if ($db->getErrorNum()) {
         $app = JFactory::getApplication();
         $app->enqueueMessage('Giant Content can not enable "Content - Giant Content" plugin. Please enable plugin manually in the plugin manager.', 'warning');
     }
     return true;
 }
Example #6
0
 /**
  * method to install the component
  *
  * @return void
  */
 function install($parent)
 {
     // $parent is the class calling this method
     //$parent->getParent()->setRedirectURL('index.php?option=com_helloworld');
     // installing module
     $module_installer = new JInstaller();
     if (@$module_installer->install(dirname(__FILE__) . DS . 'admin' . DS . 'module')) {
         echo 'Module install success', '<br />';
     } else {
         echo 'Module install failed', '<br />';
     }
     // installing plugin
     $plugin_installer = new JInstaller();
     if ($plugin_installer->install(dirname(__FILE__) . DS . 'admin' . DS . 'plugin')) {
         echo 'Plugin install success', '<br />';
     } else {
         echo 'Plugin install failed', '<br />';
     }
     // installing router
     $plugin_installer = new JInstaller();
     if ($plugin_installer->install(dirname(__FILE__) . DS . 'admin' . DS . 'router')) {
         echo 'Router install success', '<br />';
     } else {
         echo 'Router install failed', '<br />';
     }
     // enabling plugin
     $db =& JFactory::getDBO();
     $db->setQuery('update #__extensions set enabled = 1 where element = "jumi" and folder = "system"');
     $db->query();
     // enabling router
     $db->setQuery('update #__extensions set enabled = 1, ordering = 100 where element = "jumirouter" and folder = "system"');
     $db->query();
 }
 public function postflight($type, $parent)
 {
     $db = JFactory::getDBO();
     $db->setQuery("UPDATE #__extensions SET enabled = 0 WHERE client_id = 1 AND element = " . $db->Quote($parent->get('element')));
     $db->query();
     $status = new stdClass();
     $status->plugins = array();
     $src = $parent->getParent()->getPath('source');
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $path = $src . '/plugins/' . $group . '/' . $name;
         $installer = new JInstaller();
         $result = $installer->install($path);
         if ($result) {
             if (JFile::exists(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml')) {
                 JFile::delete(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
             }
             JFile::move(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.j25.xml', JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
         }
         $query = "UPDATE #__extensions SET enabled=1, ordering=99 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
         $db->setQuery($query);
         $db->query();
         $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
     }
     $this->installationResults($status);
 }
 function postflight($type, $parent)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $db->setQuery("UPDATE #__extensions SET enabled = 1 WHERE folder='content' AND element = '{$this->extensionName}'");
     $db->execute();
     $status = new stdClass();
     $status->plugins = array();
     $src = $parent->getParent()->getPath('source');
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $path = $src . '/plugins/' . $group;
         if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
             $path = $src . '/plugins/' . $group . '/' . $name;
         }
         $installer = new JInstaller();
         $result = $installer->install($path);
         $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
         $db->setQuery($query);
         $db->query();
         $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
     }
     //echo "<p>Installed</p>";
     $this->results($status, $parent, "install");
 }
Example #9
0
 function postflight($type, $parent)
 {
     $db = JFactory::getDBO();
     $status = new stdClass();
     $status->plugins = array();
     $src = $parent->getParent()->getPath('source');
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $key => $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $path = $src . '/plugins/' . $group;
         if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
             $path = $src . '/plugins/' . $group . '/' . $name;
         }
         $installer = new JInstaller();
         $result = $installer->install($path);
         if ($result) {
             $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
             $db->setQuery($query);
             $db->query();
         }
     }
     $template_path = $src . '/template';
     if (JFolder::exists($template_path)) {
         $installer = new JInstaller();
         $installer->install($template_path);
     }
     $conf = JFactory::getConfig();
     $conf->set('debug', false);
     $parent->getParent()->abort();
 }
 /**
  * method to install the component
  *
  * @return void
  */
 function install($parent)
 {
     $manifest = $parent->get("manifest");
     $parent = $parent->getParent();
     $source = $parent->getPath("source");
     $installer = new JInstaller();
     // Install plugins
     foreach ($manifest->plugins->plugin as $plugin) {
         $attributes = $plugin->attributes();
         $plg = $source . DIRECTORY_SEPARATOR . $attributes['folder'] . DIRECTORY_SEPARATOR . $attributes['plugin'];
         $installer->install($plg);
     }
     $db = JFactory::getDbo();
     $tableExtensions = "#__extensions";
     //$db->quote("#__extensions");
     $columnElement = "element";
     //$db->quote("element");
     $columnType = "type";
     //$db->quote("type");
     $columnFolder = "folder";
     //$db->quote("folder");
     $columnEnabled = "enabled";
     //$db->quote("enabled",false);
     // Enable plugins
     $db->setQuery("UPDATE\n                    {$tableExtensions}\n                SET\n                    {$columnEnabled}=1\n                WHERE\n                    {$columnElement}='admirorgallery'\n                AND\n                    {$columnType}='plugin'\n                AND\n                    {$columnFolder}='content'");
     $this->gallery_install_result = $db->query();
     // Enable plugins
     $db->setQuery("UPDATE\n                    {$tableExtensions}\n                SET\n                    {$columnEnabled}=1\n                WHERE\n                    {$columnElement}='admirorbutton'\n                AND\n                    {$columnType}='plugin'\n                AND\n                    {$columnFolder}='editors-xtd'");
     $this->button_install_result = $db->query();
 }
Example #11
0
 function update($parent)
 {
     $manifest = $parent->get("manifest");
     $parent = $parent->getParent();
     $source = $parent->getPath("source");
     foreach ($manifest->plugins->plugin as $plugin) {
         $installer = new JInstaller();
         $attributes = $plugin->attributes();
         $plg = $source . "/" . $attributes['folder'] . "/" . $attributes['plugin'];
         $installer->install($plg);
     }
     $db = JFactory::getDBO();
     // Fixes a Joomla bug, wich adds a second repository rather than overwrite the first one if they are different
     $query = "DELETE FROM `#__update_sites` WHERE `name` = '" . $this->extension_name . " update site';";
     $db->setQuery($query);
     $db->query();
     $query = "DELETE FROM `#__update_sites` WHERE `name` = 'Ozio Gallery3 update site';";
     $db->setQuery($query);
     $db->query();
     // Clear updates cache related to this extension
     $query = "DELETE FROM `#__updates` WHERE `name` = '" . $this->extension_name . "';";
     $db->setQuery($query);
     $db->query();
     // Shows the installation/upgrade message
     $this->message();
 }
Example #12
0
 function installExtensions($extPath = null)
 {
     //if no path defined, use default path
     if ($extPath == null) {
         $extPath = dirname(__FILE__) . DS . 'extensions';
     }
     if (!JFolder::exists($extPath)) {
         return false;
     }
     $extensions = JFolder::folders($extPath);
     //no apps there to install
     if (empty($extensions)) {
         return true;
     }
     //get instance of installer
     $installer = new JInstaller();
     $installer->setOverwrite(true);
     //install all apps
     foreach ($extensions as $ext) {
         $msg = "Supportive Plugin/Module {$ext} Installed Successfully";
         // Install the packages
         if ($installer->install($extPath . DS . $ext) == false) {
             $msg = "Supportive Plugin/Module {$ext} Installation Failed";
         }
         //enque the message
         JFactory::getApplication()->enqueueMessage($msg);
     }
     return true;
 }
Example #13
0
 /**
  * method to install the component
  *
  * @return void
  */
 function install($parent)
 {
     // General settings
     $status = new JObject();
     $status->modules = array();
     // Array to store module and plugin installation results
     $result = array();
     $indice = 0;
     $installer = new JInstaller();
     $manifest = $parent->get("manifest");
     $parent = $parent->getParent();
     $source = $parent->getPath("source");
     foreach ($manifest->plugins->plugin as $plugin) {
         $installer = new JInstaller();
         $attributes = $plugin->attributes();
         $plg = $source . DIRECTORY_SEPARATOR . $attributes['folder'] . DIRECTORY_SEPARATOR . $attributes['plugin'];
         $result[$indice] = $installer->install($plg);
         $indice++;
     }
     $db = JFactory::getDbo();
     $tableExtensions = $db->quoteName("#__extensions");
     $columnElement = $db->quoteName("element");
     $columnType = $db->quoteName("type");
     $columnEnabled = $db->quoteName("enabled");
     // Enable Tracker plugin
     $db->setQuery("UPDATE \n\t\t\t\t{$tableExtensions}\n\t\t\tSET\n\t\t\t\t{$columnEnabled}=1\n\t\t\tWHERE\n\t\t\t\t{$columnElement}='tracker'\n\t\t\tAND\n\t\t\t\t{$columnType}='plugin'");
     $db->execute();
 }
Example #14
0
/**
 * Main installer
 */
function com_install()
{
    $errors = FALSE;
    //-- common images
    $img_OK = '<img src="images/publish_g.png" />';
    $img_WARN = '<img src="images/publish_y.png" />';
    $img_ERROR = '<img src="images/publish_r.png" />';
    $BR = '<br />';
    //--install...
    $db =& JFactory::getDBO();
    $query = "CREATE TABLE IF NOT EXISTS `#__friendmanager` (  " . "`id` int(11) NOT NULL auto_increment, " . "`backupdate` datetime NOT NULL, " . "`msg` varchar(50) NOT NULL default '', " . "PRIMARY KEY  (`id`) " . ")";
    $db->setQuery($query);
    if (!$db->query()) {
        echo $img_ERROR . JText::_('Unable to create table') . $BR;
        echo $db->getErrorMsg();
        return FALSE;
    }
    // Install plg_geocode
    $plugin_installer = new JInstaller();
    if ($plugin_installer->install(dirname(__FILE__) . DS . 'plg_firstfriend')) {
        echo "<br/><hr><h1>First Friend Plugin Installed and Published " . $img_OK . "</h1><hr><br />";
    } else {
        echo "<br/><hr><h1>First Friend Plugin Not Installed " . $img_ERROR . "</h1><hr><br />";
    }
    // Enable plg_geocode
    $db->setQuery("UPDATE #__plugins SET published = 1 WHERE " . "name = 'FirstFriend' ");
    $db->query();
    return TRUE;
}
Example #15
0
 public function postflight($type, $parent)
 {
     $db = JFactory::getDBO();
     $status = new stdClass();
     $status->modules = array();
     $status->plugins = array();
     $status->libraries = array();
     $src = $parent->getParent()->getPath('source');
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $path = $src . '/plugins/' . $group;
         if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
             $path = $src . '/plugins/' . $group . '/' . $name;
         }
         $installer = new JInstaller();
         $result = $installer->install($path);
         $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
         $db->setQuery($query);
         $db->query();
         $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
     }
     $modules = $manifest->xpath('modules/module');
     foreach ($modules as $module) {
         $name = (string) $module->attributes()->module;
         $client = (string) $module->attributes()->client;
         if (is_null($client)) {
             $client = 'site';
         }
         $client == 'administrator' ? $path = $src . '/administrator/modules/' . $name : ($path = $src . '/modules/' . $name);
         if ($client == 'administrator') {
             $db->setQuery("SELECT id FROM #__modules WHERE `module` = " . $db->quote($name));
             $isUpdate = (int) $db->loadResult();
         }
         $installer = new JInstaller();
         $result = $installer->install($path);
         $status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
         if ($client == 'administrator' && !$isUpdate) {
             $position = version_compare(JVERSION, '3.0', '<') && $name == 'mod_k2_quickicons' ? 'icon' : 'cpanel';
             $db->setQuery("UPDATE #__modules SET `position`=" . $db->quote($position) . ",`published`='1' WHERE `module`=" . $db->quote($name));
             $db->query();
             $db->setQuery("SELECT id FROM #__modules WHERE `module` = " . $db->quote($name));
             $id = (int) $db->loadResult();
             $db->setQuery("INSERT IGNORE INTO #__modules_menu (`moduleid`,`menuid`) VALUES (" . $id . ", 0)");
             $db->query();
         }
     }
     $libraries = $manifest->xpath('library/library');
     foreach ($libraries as $library) {
         $name = (string) $library->attributes()->name;
         $path = $src . '/libraries/' . $name;
         $installer = new JInstaller();
         $result = $installer->install($path);
         $status->libraries[] = array('name' => $name, 'client' => '', 'result' => $result);
     }
     $this->installationResults($status);
 }
Example #16
0
 /**
  * method to run after an install/update/uninstall method
  *
  * @param   string      $type    Installation type (install, update, discover_install)
  * @param   JInstaller  $parent  Parent object
  *
  * @return void
  */
 function postflight($type, $parent)
 {
     $src = $parent->getParent()->getPath('source');
     // Install the babioon Library
     $source = $src . '/library/babioon';
     $installer = new JInstaller();
     $result = $installer->install($source);
 }
 /**
  * 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($type, $parent)
 {
     $installer = new JInstaller();
     $src = $parent->getParent()->getPath('source');
     $installer->install($src . '/plg_braftoncron');
     $installer_2 = new JInstaller();
     $src_2 = $parent->getParent()->getPath('source');
     $installer_2->install($src_2 . '/plg_braftoncontent');
 }
 function postflight($type, $parent)
 {
     if (version_compare(JVERSION, '3.0.0', '>')) {
         $messages = array();
         // Import required modules
         jimport('joomla.installer.installer');
         jimport('joomla.installer.helper');
         jimport('joomla.filesystem.file');
         //$db = JFactory::getDBO();
         //$query = "ALTER TABLE #__k2_items ADD FULLTEXT(extra_fields)";
         //$db->setQuery($query);
         //$db->query();
         // Get packages
         $p_dir = JPath::clean(JPATH_SITE . DS . 'components' . DS . 'com_jak2filter' . DS . 'packages');
         // Did you give us a valid directory?
         if (!is_dir($p_dir)) {
             $messages[] = JText::_('Package directory(Related modules, plugins) is missing');
         } else {
             $subpackages = JFolder::files($p_dir);
             $result = true;
             $installer = new JInstaller();
             if ($subpackages) {
                 $app = JFactory::getApplication();
                 $templateDir = 'templates/' . $app->getTemplate();
                 foreach ($subpackages as $zpackage) {
                     if (JFile::getExt($p_dir . DS . $zpackage) != "zip") {
                         continue;
                     }
                     $subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage);
                     if ($subpackage) {
                         $type = JInstallerHelper::detectType($subpackage['dir']);
                         if (!$type) {
                             $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>';
                             $result = false;
                         }
                         if (!$installer->install($subpackage['dir'])) {
                             // There was an error installing the package
                             $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>';
                         } else {
                             $messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" />&nbsp;<span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>';
                         }
                         if (!is_file($subpackage['packagefile'])) {
                             $subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile'];
                         }
                         if (is_dir($subpackage['extractdir'])) {
                             JFolder::delete($subpackage['extractdir']);
                         }
                         if (is_file($subpackage['packagefile'])) {
                             JFile::delete($subpackage['packagefile']);
                         }
                     }
                 }
             }
             JFolder::delete($p_dir);
         }
     }
 }
Example #19
0
 public function postflight($type, $parent)
 {
     $db = JFactory::getDBO();
     $status = new stdClass();
     $status->modules = array();
     $status->plugins = array();
     $manifest = $parent->getParent()->manifest;
     $plugins = $manifest->xpath('plugins/plugin');
     $modules = $manifest->xpath('modules/module');
     $src = $parent->getParent()->getPath('source');
     // Migrate plugin settings to component. Only for first time installs
     $db->setQuery("SELECT params FROM #__extensions WHERE type='plugin' AND folder = 'content' AND element = 'jw_sigpro'");
     $params = $db->loadResult();
     if ($params && $params != '{}') {
         $db->setQuery("UPDATE #__extensions SET params = " . $db->quote($params) . " WHERE type='component' AND element = 'com_sigpro'");
         $db->query();
         $db->setQuery("UPDATE #__extensions SET params = '{}' WHERE type='plugin' AND folder = 'content' AND element = 'jw_sigpro'");
         $db->query();
     }
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $path = $src . '/plugins/' . $group . '/' . $name;
         $installer = new JInstaller();
         $result = $installer->install($path);
         if ($result) {
             if (JFile::exists(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml')) {
                 JFile::delete(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
             }
             JFile::move(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.j25.xml', JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
             $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
             $db->setQuery($query);
             $db->query();
         }
         $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
     }
     foreach ($modules as $module) {
         $name = (string) $module->attributes()->module;
         $client = (string) $module->attributes()->client;
         if (is_null($client)) {
             $client = 'site';
         }
         $client == 'administrator' ? $path = $src . '/administrator/modules/' . $name : ($path = $src . '/modules/' . $name);
         $installer = new JInstaller();
         $result = $installer->install($path);
         if ($result) {
             $root = $client == 'administrator' ? JPATH_ADMINISTRATOR : JPATH_SITE;
             if (JFile::exists($root . '/modules/' . $name . '/' . $name . '.xml')) {
                 JFile::delete($root . '/modules/' . $name . '/' . $name . '.xml');
             }
             JFile::move($root . '/modules/' . $name . '/' . $name . '.j25.xml', $root . '/modules/' . $name . '/' . $name . '.xml');
         }
         $status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
     }
     $this->installationResults($status);
 }
Example #20
0
 /**
  * Check if FoF is already installed and install if not
  *
  * @param   object  $parent  class calling this method
  *
  * @return  array            Array with performed actions summary
  */
 private function _installFOF($parent)
 {
     $src = $parent->getParent()->getPath('source');
     // Load dependencies
     JLoader::import('joomla.filesystem.file');
     JLoader::import('joomla.utilities.date');
     $source = $src . '/fof';
     if (!defined('JPATH_LIBRARIES')) {
         $target = JPATH_ROOT . '/libraries/fof';
     } else {
         $target = JPATH_LIBRARIES . '/fof';
     }
     $haveToInstallFOF = false;
     if (!is_dir($target)) {
         $haveToInstallFOF = true;
     } else {
         $fofVersion = array();
         if (file_exists($target . '/version.txt')) {
             $rawData = JFile::read($target . '/version.txt');
             $info = explode("\n", $rawData);
             $fofVersion['installed'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         } else {
             $fofVersion['installed'] = array('version' => '0.0', 'date' => new JDate('2011-01-01'));
         }
         $rawData = JFile::read($source . '/version.txt');
         $info = explode("\n", $rawData);
         $fofVersion['package'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         $haveToInstallFOF = $fofVersion['package']['date']->toUNIX() > $fofVersion['installed']['date']->toUNIX();
     }
     $installedFOF = false;
     if ($haveToInstallFOF) {
         $versionSource = 'package';
         $installer = new JInstaller();
         $installedFOF = $installer->install($source);
     } else {
         $versionSource = 'installed';
     }
     if (!isset($fofVersion)) {
         $fofVersion = array();
         if (file_exists($target . '/version.txt')) {
             $rawData = JFile::read($target . '/version.txt');
             $info = explode("\n", $rawData);
             $fofVersion['installed'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         } else {
             $fofVersion['installed'] = array('version' => '0.0', 'date' => new JDate('2011-01-01'));
         }
         $rawData = JFile::read($source . '/version.txt');
         $info = explode("\n", $rawData);
         $fofVersion['package'] = array('version' => trim($info[0]), 'date' => new JDate(trim($info[1])));
         $versionSource = 'installed';
     }
     if (!$fofVersion[$versionSource]['date'] instanceof JDate) {
         $fofVersion[$versionSource]['date'] = new JDate();
     }
     return array('required' => $haveToInstallFOF, 'installed' => $installedFOF, 'version' => $fofVersion[$versionSource]['version'], 'date' => $fofVersion[$versionSource]['date']->format('Y-m-d'));
 }
Example #21
0
 /**
  * method to install the component
  *
  * @return void
  */
 function install($parent)
 {
     // installing module
     $module_installer = new JInstaller();
     if (@$module_installer->install(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'module')) {
         echo '<p>' . JText::_('COM_SEXYCONTACTFORM_MODULE_INSTALL_SUCCESS') . '</p>';
     } else {
         echo '<p>' . JText::_('COM_SEXYCONTACTFORM_MODULE_INSTALL_FAILED') . '</p>';
     }
 }
Example #22
0
        function install()
        {
            $pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . $this->com . DS . 'extensions' . DS;
            $extensions = array_merge(JFolder::folders($pkg_path, '^(?!com_)\\w+$'), JFolder::folders($pkg_path, '^com_\\w+$'));
            $v3 = version_compare(JVERSION, '3.0.0', 'ge');
            if ($v3) {
                foreach ($extensions as $pkg) {
                    $f = $pkg_path . DS . $pkg;
                    $xmlfiles = JFolder::files($f, '.xml$', 1, true);
                    foreach ($xmlfiles as $xmlf) {
                        $file = file_get_contents($xmlf);
                        file_put_contents($xmlf, preg_replace("/<\\/install/", "</extension", preg_replace("/<install/", "<extension", $file)));
                    }
                }
            }
            foreach ($extensions as $pkg) {
                if ($pkg == 'plg_offlajnjoomla3compat' && !$v3 || $pkg == 'plg_sticky_toolbar' && !$v3) {
                    continue;
                }
                $installer = new JInstaller();
                $installer->setOverwrite(true);
                if ($success = $installer->install($pkg_path . DS . $pkg)) {
                    $msgcolor = "#E0FFE0";
                    $msgtext = "{$pkg} successfully installed.";
                } else {
                    $msgcolor = "#FFD0D0";
                    $msgtext = "ERROR: Could not install the {$pkg}. Please contact us on our support page: http://offlajn.com/support.html";
                }
                ?>
        <table bgcolor="<?php 
                echo $msgcolor;
                ?>
" width ="100%">
          <tr style="height:30px">
            <td><font size="2"><b><?php 
                echo $msgtext;
                ?>
</b></font></td>
          </tr>
        </table><?php 
                if ($success && file_exists("{$pkg_path}/{$pkg}/install.php")) {
                    require_once "{$pkg_path}/{$pkg}/install.php";
                    $com = new $pkg();
                    $com->install();
                }
            }
            $db = JFactory::getDBO();
            if (version_compare(JVERSION, '1.6.0', 'lt')) {
                $db->setQuery("UPDATE #__plugins SET published=1 WHERE name LIKE '%offlajn%' OR name LIKE 'Nextend Joomla 3.0 compatibility' OR name LIKE 'Nextend Dojo Loader'");
            } else {
                $db->setQuery("UPDATE #__extensions SET enabled=1 WHERE (name LIKE '%offlajn%' OR name LIKE 'Nextend Joomla 3.0 compatibility' OR name LIKE 'Nextend Dojo Loader') AND type='plugin'");
            }
            $db->query();
        }
Example #23
0
 function update($parent)
 {
     $manifest = $parent->get('manifest');
     $parent = $parent->getParent();
     $source = $parent->getPath('source');
     $installer = new JInstaller();
     foreach ($manifest->plugins->plugin as $plugin) {
         $attributes = $plugin->attributes();
         $plg = $source . DS . $attributes['folder'] . DS . $attributes['plugin'];
         $installer->install($plg);
     }
 }
Example #24
0
 /**
  * Method to install the embedded third extensions.
  *
  * @access	private
  * @param	JAdapterInstance	$adapter	Installer Component Adapter.
  * @return	void
  *
  * @since	Cook 2.6
  */
 private function installExtensions(JAdapterInstance $adapter)
 {
     $dir = $adapter->getParent()->getPath('source') . DS . 'extensions';
     $installResults = array();
     jimport('joomla.filesystem.folder');
     $folders = JFolder::folders($dir);
     foreach ($folders as $folder) {
         $source = $dir . DS . $folder;
         $installer = new JInstaller();
         $installResults[] = $installer->install($source);
     }
 }
Example #25
0
 function com_install()
 {
     JAVoiceHelpers::Install_Db();
     $messages = array();
     // Import required modules
     jimport('joomla.installer.installer');
     jimport('joomla.installer.helper');
     jimport('joomla.filesystem.file');
     // Get packages
     $p_dir = JPath::clean(JPATH_SITE . '/components/com_javoice/packages');
     // Did you give us a valid directory?
     if (!is_dir($p_dir)) {
         $messages[] = JText::_('Package directory(Related modules, plugins) is missing');
     } else {
         $subpackages = JFolder::files($p_dir);
         $result = true;
         $installer = new JInstaller();
         if ($subpackages) {
             $app = JFactory::getApplication();
             $templateDir = 'templates/' . $app->getTemplate();
             foreach ($subpackages as $zpackage) {
                 if (JFile::getExt($p_dir . DS . $zpackage) != "zip") {
                     continue;
                 }
                 $subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage);
                 if ($subpackage) {
                     $type = JInstallerHelper::detectType($subpackage['dir']);
                     if (!$type) {
                         $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>';
                         $result = false;
                     }
                     if (!$installer->install($subpackage['dir'])) {
                         // There was an error installing the package
                         $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" />&nbsp;<span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>';
                     } else {
                         $messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" />&nbsp;<span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>';
                     }
                     if (!is_file($subpackage['packagefile'])) {
                         $subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile'];
                     }
                     if (is_dir($subpackage['extractdir'])) {
                         JFolder::delete($subpackage['extractdir']);
                     }
                     if (is_file($subpackage['packagefile'])) {
                         JFile::delete($subpackage['packagefile']);
                     }
                 }
             }
         }
         JFolder::delete($p_dir);
     }
 }
Example #26
0
 public function ppInstall()
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.installer.installer');
     $db =& JFactory::getDBO();
     $this->path = JInstaller::getInstance()->getPath('extension_administrator');
     // sposto la cartella "propayment"
     $src = $this->path . DS . "propayment";
     $dst = JPATH_ROOT . DS . "propayment";
     $this->recurse_move($src, $dst);
     echo "<div>Cartella 'propayment' installata nel sito</div>";
     // creo la sottocartella "log" (se non esiste)
     @mkdir($dst . "/log");
     // installo il plugin
     jimport('joomla.installer.installer');
     $installer = new JInstaller();
     $result = $installer->install($this->path . DS . 'plugin');
     if ($result) {
         // abilito il plugin
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $q = "UPDATE #__extensions SET enabled=1, name='VM - Payment, ProPayment' WHERE folder='vmpayment' AND element='propayment'";
         } else {
             $q = "UPDATE #__plugins SET published=1, name='VM - Payment, ProPayment' WHERE folder='vmpayment' AND element='propayment'";
         }
         $db->setQuery($q);
         $db->query();
         // elimino la cartella "plugin"
         $this->recursiveDelete($this->path . DS . 'plugin');
         echo "<h3>Componente e Plugin ProPayment installati.</h3>";
     } else {
         echo "<h3>Errore nell'installazione del plugin per VirtueMart 2!</h3>";
     }
     // modifico le voci di menu, in caso di Joomla 1.5
     if (!version_compare(JVERSION, '1.6.0', 'ge')) {
         $q = "UPDATE #__components SET name='ProPayment' WHERE name='COM_PROPAYMENT' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Configurazione' WHERE name='MNU_CONFIG' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Installazione moduli' WHERE name='MNU_INSTALL' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Log errori' WHERE name='MNU_LOG_ERR' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
         $q = "UPDATE #__components SET name='Log transazioni' WHERE name='MNU_LOG_TRN' AND `option`='com_propayment'";
         $db->setQuery($q);
         $db->query();
     }
     return true;
 }
Example #27
0
 /**
 * method to install the component
 *
 * @return void
 * <div id="system-message-container">
 <div id="system-message">
 <div class="alert alert-message"><a class="close" data-dismiss="alert">×</a>
 <h4 class="alert-heading">Message</h4>
 <div>
 		<p>Installing component was successful.</p>
 </div>
 </div>
 </div>
 </div>
 */
 function install($parent)
 {
     // $parent is the class calling this method
     echo '<div id="system-message-container">';
     $msgtext = "";
     echo '<div id="system-message">
             <div style=" overflow:hidden; margin:8px 0 8px 0; padding:5px;" >
             <div style=" font-size:12px; margin:0px 0 0px 0; padding:5px; position:relative; float:right;"><div>Powered by Percha.com</div></div>
             <div style="float:left; margin:0 20px 20px 0;"><img src="http://www.fieldsattach.com/images/logo_fieldsattach_small.png" alt="fieldsattach.com" /></div>
             <div style="   margin:30px 0 8px 0; padding:5px; font-size:23px; color:#4892AB;">Thanks for install the Fieldsattach component.</div>
             </div>';
     //INSTALL THE PLUGINS *******************************************************************************
     $installer = new JInstaller();
     //$installer->_overwrite = true;
     $pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_fieldsattach' . DS . 'extensions' . DS;
     $pkgs = array('input.zip' => 'Plugin fieldsattachment <strong>Input</strong>', 'file.zip' => 'Plugin fieldsattachment <strong>File</strong>', 'image.zip' => 'Plugin fieldsattachment <strong>image</strong>', 'imagegallery.zip' => 'Plugin fieldsattachment <strong>imagegallery</strong>', 'select.zip' => 'Plugin fieldsattachment <strong>select</strong>', 'textarea.zip' => 'Plugin fieldsattachment <strong>textarea</strong>', 'content_fieldsattachment.zip' => 'Plugin Content FieldsAttachment', 'system_fieldsattachment.zip' => 'Plugin System FieldsAttachment', 'advancedsearch_fieldsattachment.zip' => 'Plugin Advanced Search FieldsAttachment', 'filterarticles.zip' => 'Plugin Advanced FILTER FieldsAttachment');
     foreach ($pkgs as $pkg => $pkgname) {
         $package = JInstallerHelper::unpack($pkg_path . $pkg);
         if ($installer->install($package['dir'])) {
             $msgtext .= '<div id="system-message-container"><div class="alert alert-message">' . $pkgname . ' successfully installed.</div></div>';
             //ACTIVE IT
         } else {
             $msgtext .= '<div id="system-message-container"><div class="alert alert-message">ERROR: Could not install the $pkgname. Please install manually</div></div>';
         }
         //ACTIVE THE PLUGINS *******************************************************************************
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 1 WHERE  element = 'fieldsattachment'";
         $db->setQuery($sql);
         $db->query();
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 1 WHERE  element = 'fieldsattachmentadvanced'";
         $db->setQuery($sql);
         $db->query();
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 1 WHERE  folder = 'fieldsattachment'";
         $db->setQuery($sql);
         $db->query();
         //DESACTIVE OLD SEARCH
         $db = JFactory::getDBO();
         $sql = "UPDATE #__extensions  SET enabled = 0 WHERE  element = 'fieldsattachment' AND folder='search'";
         $db->setQuery($sql);
         $db->query();
         JInstallerHelper::cleanupInstall($pkg_path . $pkg, $package['dir']);
     }
     //DELETE EXTENSIONS
     $pkg_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_fieldsattach' . DS . 'extensions' . DS;
     destroy_dir($pkg_path);
     $msgtext .= '<div id="system-message-container"><div class="alert alert-message">Clean install directory:  ' . $pkg_path . '</div></div>';
     echo $msgtext;
     echo '</div>';
     //$parent->getParent()->setRedirectURL('index.php?option=com_helloworld');
 }
Example #28
0
 public function postflight($type, $parent)
 {
     $db = JFactory::getDBO();
     $status = new stdClass();
     $status->modules = array();
     $status->plugins = array();
     $src = $parent->getParent()->getPath('source');
     $manifest = $parent->getParent()->manifest;
     $modules = $manifest->xpath('modules/module');
     foreach ($modules as $module) {
         $name = (string) $module->attributes()->module;
         $client = (string) $module->attributes()->client;
         if (is_null($client)) {
             $client = 'site';
         }
         $client == 'administrator' ? $path = $src . '/administrator/modules/' . $name : ($path = $src . '/modules/' . $name);
         $installer = new JInstaller();
         $result = $installer->install($path);
         if ($result) {
             $root = $client == 'administrator' ? JPATH_ADMINISTRATOR : JPATH_SITE;
             if (JFile::exists($root . '/modules/' . $name . '/' . $name . '.xml')) {
                 JFile::delete($root . '/modules/' . $name . '/' . $name . '.xml');
             }
             JFile::move($root . '/modules/' . $name . '/' . $name . '.j25.xml', $root . '/modules/' . $name . '/' . $name . '.xml');
         }
         $status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
     }
     $plugins = $manifest->xpath('plugins/plugin');
     foreach ($plugins as $plugin) {
         $name = (string) $plugin->attributes()->plugin;
         $group = (string) $plugin->attributes()->group;
         $path = $src . '/plugins/' . $group;
         if (JFolder::exists($src . '/plugins/' . $group . '/' . $name)) {
             $path = $src . '/plugins/' . $group . '/' . $name;
         }
         $installer = new JInstaller();
         $result = $installer->install($path);
         if ($result && $group != 'finder' && $group != 'josetta_ext') {
             if (JFile::exists(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml')) {
                 JFile::delete(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
             }
             JFile::move(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.j25.xml', JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml');
         }
         $query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group);
         $db->setQuery($query);
         $db->query();
         $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
     }
     $this->installationResults($status);
 }
Example #29
0
 private function chain_install(&$parent)
 {
     $manifest = $parent->get("manifest");
     $p_installer = $parent->getParent();
     $installer = new JInstaller();
     // Install modules
     if (is_object($manifest->modules->module)) {
         foreach ($manifest->modules->module as $module) {
             $attributes = $module->attributes();
             $mod = $p_installer->getPath("source") . DS . $attributes['folder'] . DS . $attributes['module'];
             $installer->install($mod);
         }
     }
 }
Example #30
0
 /**
  * method to install the component
  *
  * @return void
  */
 function install($parent)
 {
     $manifest = $parent->get("manifest");
     $parent = $parent->getParent();
     $source = $parent->getPath("source");
     $installer = new JInstaller();
     // Install plugins
     foreach ($manifest->plugins->plugin as $plugin) {
         $attributes = $plugin->attributes();
         $plg = $source . '/' . $attributes['folder'] . '/' . $attributes['plugin'];
         $plg = $source . '/' . $attributes['folder'];
         $installer->install($plg);
     }
     // Install modules
     foreach ($manifest->modules->module as $module) {
         $attributes = $module->attributes();
         $mod = $source . '/' . $attributes['folder'] . '/' . $attributes['module'];
         $installer->install($mod);
     }
     $db = JFactory::getDbo();
     $tableExtensions = $db->nameQuote("#__extensions");
     $columnElement = $db->nameQuote("element");
     $columnType = $db->nameQuote("type");
     $columnEnabled = $db->nameQuote("enabled");
     $tableExtensions = "#__extensions";
     $columnElement = "element";
     $columnType = "type";
     $columnEnabled = "enabled";
     // Enable plugins
     $db->setQuery("UPDATE \r\n                    {$tableExtensions}\r\n                SET\r\n                    {$columnEnabled}=1\r\n                WHERE\r\n                    ({$columnElement}='courses' or {$columnElement}='coursecategories' or {$columnElement}='coursetopics' or {$columnElement}='joomdlehooks')\r\n                AND\r\n                    {$columnType}='plugin'");
     $db->query();
     // Set plugin ordering
     $db->setQuery("UPDATE \r\n                    {$tableExtensions}\r\n                SET\r\n                    ordering=100\r\n                WHERE\r\n                    {$columnElement}='joomdlehooks' \r\n                AND\r\n                    {$columnType}='plugin'");
     $db->query();
     //			$this->create_tables ();
 }