Example #1
0
 /**
  * Read content files
  *
  * @return void
  *
  * @throws Exception
  */
 public function readContentElementFile()
 {
     NenoLog::log('Method readContentElementFile of NenoControllerGroupsElements called', 3);
     jimport('joomla.filesystem.file');
     NenoLog::log('Trying to move content element files', 3);
     $input = JFactory::getApplication()->input;
     $fileData = $input->files->get('content_element');
     $destFile = JFactory::getConfig()->get('tmp_path') . '/' . $fileData['name'];
     $extractPath = JFactory::getConfig()->get('tmp_path') . '/' . JFile::stripExt($fileData['name']);
     // If the file has been moved successfully, let's work with it.
     if (JFile::move($fileData['tmp_name'], $destFile) === true) {
         NenoLog::log('Content element files moved successfully', 2);
         // If the file is a zip file, let's extract it
         if ($fileData['type'] == 'application/zip') {
             NenoLog::log('Extracting zip content element files', 3);
             $adapter = JArchive::getAdapter('zip');
             $adapter->extract($destFile, $extractPath);
             $contentElementFiles = JFolder::files($extractPath);
         } else {
             $contentElementFiles = array($destFile);
         }
         // Add to each content file the path of the extraction location.
         NenoHelper::concatenateStringToStringArray($extractPath . '/', $contentElementFiles);
         NenoLog::log('Parsing element files for readContentElementFile', 3);
         // Parse element file(s)
         NenoHelperBackend::parseContentElementFile(JFile::stripExt($fileData['name']), $contentElementFiles);
         NenoLog::log('Cleaning temporal folder for readContentElementFile', 3);
         // Clean temporal folder
         NenoHelperBackend::cleanFolder(JFactory::getConfig()->get('tmp_path'));
     }
     NenoLog::log('Redirecting to groupselements view', 3);
     $this->setRedirect('index.php?option=com_neno&view=groupselements')->redirect();
 }
Example #2
0
 function install($adapter)
 {
     $installer = $this->installer;
     $installer->AddSQLFromFile('install.bids.inserts.sql');
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     JFolder::move(JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'templates-dist', JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'templates');
     JFile::move(JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'options.php-dist', JPATH_SITE . DS . 'components' . DS . 'com_bids' . DS . 'options.php');
     JFolder::create(JPATH_SITE . DS . 'images' . DS . 'auctions');
     $installer->AddMenuItem("Auction Factory MENU", "List Auctions", "list-auctions", "index.php?option=com_bids&task=listauctions", 1);
     $installer->AddMenuItem("Auction Factory MENU", "Categories", "categories-auctions", "index.php?option=com_bids&task=listcats", 1);
     $installer->AddMenuItem("Auction Factory MENU", "Search", "search-auctions", "index.php?option=com_bids&task=search", 1);
     $installer->AddMenuItem("Auction Factory MENU", "New Auction", "post-offer", "index.php?option=com_bids&task=newauction", 2);
     $installer->AddMenuItem("Auction Factory MENU", "My Auctions", "my-auctions", "index.php?option=com_bids&task=myauctions", 2);
     $installer->AddMenuItem("Auction Factory MENU", "Watchlist", "watchlist", "index.php?option=com_bids&task=mywatchlist", 2);
     $installer->AddMenuItem("Auction Factory MENU", "My Bids", "my-bids", "index.php?option=com_bids&task=mybids", 2);
     $installer->AddMenuItem("Auction Factory MENU", "Profile", "profile-auctions", "index.php?option=com_bids&task=userdetails", 2);
     $installer->AddCBPlugin('Bids MyAuctions', 'My Auctions', 'bids.myauctions', 'getmyauctionsTab');
     $installer->AddCBPlugin('Bids MyBids', 'My Bids', 'bids.mybids', 'getmybidsTab');
     $installer->AddCBPlugin('Bids MyRatings', 'My Ratings', 'bids.myratings', 'getmyratingsTab');
     $installer->AddCBPlugin('Bids MySettings', 'My Settings', 'bids.mysettings', 'getmysettingsTab');
     $installer->AddCBPlugin('Bids MyTaskpad', 'My Taskpad', 'bids.mytaskpad', 'myTaskPad');
     $installer->AddCBPlugin('Bids MyWatchlist', 'My Watchlist', 'bids.mywatchlist', 'getmywatchlistTab');
     $installer->AddCBPlugin('Bids MyWonBids', 'My Won Bids', 'bids.mywonbids', 'getmywonbidsTab');
     $installer->AddMessage("Thank you for purchasing <strong>Auctions Factory</strong>");
     $installer->AddMessageFromFile('install.notes.txt');
     $installer->AddMessage("Please set up your <strong>Auctions Factory</strong> in the <a href='" . JURI::root() . "administrator/index.php?option=com_bids&task=settingsmanager'>admin panel</a></p>");
     $installer->AddMessage("Visit us at <a target='_blank' href='http://www.thefactory.ro'>thefactory.ro</a> to learn  about new versions and/or to give us feedback<br>");
     $installer->AddMessage("&copy; 2006-" . date('Y') . " thefactory.ro");
     $installer->insertDefaultCategory();
     $installer->install();
 }
 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);
 }
Example #4
0
 /**
  * Method to handle upload action
  *
  * @return  void
  */
 public function uploadAction()
 {
     if ($this->request->getMethod() != 'POST') {
         return;
     }
     if (isset($_FILES['font-upload']) and $_FILES['font-upload']['error'] == 0) {
         // Verify font file
         if (!preg_match('/\\.(ttf|otf|eot|svg|woff)$/', $_FILES['font-upload']['name'])) {
             exit(JText::_('JSN_TPLFW_FONT_FILE_NOT_SUPPORTED'));
         }
         // Prepare directory to store uploaded font file
         $path = JPATH_ROOT . "/templates/{$this->template['name']}/uploads/fonts";
         if (!is_dir($path) and !JFolder::create($path)) {
             exit(JText::_('JSN_TPLFW_UPLOAD_CREATE_DIR_FAIL'));
         }
         // Check if the directory is writable
         $buffer = '<html><head></head><body></body></html>';
         if (!JFile::write("{$path}/index.html", $buffer)) {
             exit(JText::_('JSN_TPLFW_UPLOAD_CREATE_DIR_FAIL'));
         }
         // Move uploaded file to temporary folder
         $path .= '/' . str_replace(' ', '-', $_FILES['font-upload']['name']);
         if (!JFile::move($_FILES['font-upload']['tmp_name'], $path)) {
             exit(JText::_('JSN_TPLFW_UPLOAD_MOVE_FILE_FAIL'));
         }
     } else {
         exit(JText::sprintf('JSN_TPLFW_UPLOAD_FAIL', isset($_FILES['font-upload']) ? $_FILES['font-upload']['error'] : 'unknown'));
     }
     exit('OK');
 }
 function install(&$plg)
 {
     $src = dirname(__FILE__) . DS . 'component';
     $dest = JPATH_ROOT . DS . 'components' . DS . 'com_jshopping';
     $lang =& JFactory::getLanguage();
     $inst =& JInstaller::getInstance();
     $desc = (string) $inst->getManifest()->description;
     $lang->load('plg_jshoppingcheckout_' . $this->_name . '.sys', JPATH_ADMINISTRATOR, null, true);
     $inst->set('message', JText::_($desc));
     if (!JFolder::exists($dest)) {
         return false;
     }
     if (JFolder::exists($src)) {
         foreach (JFolder::folders($src) as $f) {
             JFolder::copy($src . DS . $f, $dest . DS . $f, '', true);
         }
     }
     // Конфигурирование JoomShopping (установка дополнений)
     $this->jshoppingUpdate();
     $res = false;
     $path = JPATH_ROOT . DS . 'components' . DS . 'com_jshopping' . DS . 'shippings' . DS . $this->_name . DS;
     if (extension_loaded('ionCube Loader')) {
         // use ionCube
         $res = true;
     } else {
         // check zend loader/optimizer
         $list = get_loaded_extensions();
         foreach ($list as &$item) {
             if (preg_match("/zend.*(loader|optimizer)/i", $item)) {
                 $res = true;
                 break;
             }
         }
         if ($res) {
             // Zend was found, detect php version
             if (version_compare(phpversion(), "5.3") >= 0) {
                 // php > 5.3
                 JFile::move($this->_name . '_5.3.php', $this->_name . '.php', $path);
             } else {
                 JFile::move($this->_name . '_5.2.php', $this->_name . '.php', $path);
             }
         }
     }
     if (JFile::exists($path . $this->_name . '_5.2.php')) {
         JFile::delete($path . $this->_name . '_5.2.php');
     }
     if (JFile::exists($path . $this->_name . '_5.3.php')) {
         JFile::delete($path . $this->_name . '_5.3.php');
     }
     if ($res) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::_('PED_INSTALL_NOTIFY'), 'notice');
     } else {
         JError::raiseNotice('500', JText::_('PED_ZEND_NOT_LOADED'));
     }
     return true;
 }
Example #6
0
 public function postflight($type, $parent)
 {
     if (parent::postflight($type, $parent)) {
         JLoader::import('joomla.filesystem.file');
         JFile::move('com_redmigrator.xml', 'redmigrator.xml', JPATH_ADMINISTRATOR . '/components/com_redmigrator');
         return true;
     }
     return false;
 }
Example #7
0
    function install()
    {
        acymailing_increasePerf();
        $newConfig = new stdClass();
        $newConfig->installcomplete = 1;
        $config = acymailing_config();
        $updateHelper = acymailing_get('helper.update');
        if (!$config->save($newConfig)) {
            $updateHelper->installTables();
            return;
        }
        jimport('joomla.filesystem.folder');
        $frontLanguages = JFolder::folders(JPATH_ROOT . DS . 'language', '-');
        $backLanguages = JFolder::folders(JPATH_ADMINISTRATOR . DS . 'language', '-');
        $installedLanguages = array_unique(array_merge($frontLanguages, $backLanguages));
        if (($key = array_search('en-GB', $installedLanguages)) !== false) {
            unset($installedLanguages[$key]);
        }
        if (!empty($installedLanguages)) {
            $js = 'try{
				var ajaxCall = new Ajax("index.php?option=com_acymailing&ctrl=file&task=installLanguages&tmpl=component&languages=' . implode(',', $installedLanguages) . '",{
					method: "get",
					onComplete: function(responseText, responseXML) {
						container = document.getElementById("acymailing_div");
						container.innerHTML = responseText+container.innerHTML;
					}
				}).request();
			}catch(err){
				new Request({
					url:"index.php?option=com_acymailing&ctrl=file&task=installLanguages&tmpl=component&languages=' . implode(',', $installedLanguages) . '",
					method: "get",
					onSuccess: function(responseText, responseXML) {
						container = document.getElementById("acymailing_div");
						container.innerHTML = responseText+container.innerHTML;
					}
				}).send();
			}';
            $doc = JFactory::getDocument();
            $doc->addScriptDeclaration($js);
        }
        $updateHelper->initList();
        $updateHelper->installTemplates();
        $updateHelper->installNotifications();
        $updateHelper->installMenu();
        $updateHelper->installExtensions();
        $updateHelper->installBounceRules();
        $updateHelper->fixDoubleExtension();
        $updateHelper->addUpdateSite();
        $updateHelper->fixMenu();
        if (ACYMAILING_J30) {
            JFile::move(ACYMAILING_BACK . 'acymailing_j3.xml', ACYMAILING_BACK . 'acymailing.xml');
        }
        $acyToolbar = acymailing::get('helper.toolbar');
        $acyToolbar->setTitle('AcyMailing', 'dashboard');
        $acyToolbar->display();
        $this->_iframe(ACYMAILING_UPDATEURL . 'install&fromversion=' . JRequest::getCmd('fromversion') . '&fromlevel=' . JRequest::getCmd('fromlevel'));
    }
Example #8
0
 function postflight($type, $parent)
 {
     $db = JFactory::getDbo();
     // Enable the cronjob plugin
     $db->setQuery("UPDATE " . $db->quoteName('#__extensions') . " SET " . $db->quoteName('enabled') . " = 1 WHERE " . $db->quoteName('element') . " = 'easyjoomlabackupcronjob' AND " . $db->quoteName('type') . " = 'plugin'");
     $db->execute();
     // Move CLI script to the CLI folder
     JFile::move(JPATH_ROOT . '/administrator/components/com_easyjoomlabackup/ejb_cli.php', JPATH_ROOT . '/cli/ejb_cli.php');
 }
Example #9
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 #10
0
 public static function convertLanguages15()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $config = JFactory::getConfig();
     if ($config->getValue('config.legacy')) {
         $dirs = array(JCOMMENTS_BASE . DS . 'languages' => JPATH_ROOT . DS . 'language', JCOMMENTS_BASE . DS . 'languages' . DS . 'administrator' => JPATH_ROOT . DS . 'administrator' . DS . 'language');
         foreach ($dirs as $srcLanguageDir => $dstLanguageDir) {
             if (is_writable($dstLanguageDir)) {
                 $languages = JFolder::files($srcLanguageDir, '\\.ini', false, false);
                 foreach ($languages as $language) {
                     $languageCode = substr((string) $language, 0, 5);
                     $languageDir = $dstLanguageDir . DS . $languageCode;
                     if (is_dir($languageDir)) {
                         JFile::move($srcLanguageDir . DS . $language, $languageDir . DS . $language);
                     }
                 }
                 unset($languages);
             }
         }
     }
     // frontend language files
     $files = JFolder::files(JPATH_SITE . DS . 'language', '\\.(com_jcomments|plg_search_jcomments)\\.ini', true, true);
     foreach ($files as $file) {
         $content = JFile::read($file);
         $content = self::_replaceCommentsAndQuotes($content);
         if (strpos($content, 'DATETIME_FORMAT') !== false) {
             $content = str_replace('Y-m-d', '%Y-%m-%d', $content);
             $content = str_replace('d-m-Y', '%d-%m-%Y', $content);
             $content = str_replace('d/m/Y', '%d/%m/%Y', $content);
             $content = str_replace('d.m.Y', '%d.%m.%Y', $content);
             $content = str_replace('H:i', '%H:%M', $content);
         }
         JFile::write($file, $content);
     }
     // backend language files
     $files = JFolder::files(JPATH_BASE . DS . 'language', '(com_jcomments|plg_content_jcomments|plg_search_jcomments|plg_system_jcomments|plg_user_jcomments|plg_editors-xtd_jcommentsoff|plg_editors-xtd_jcommentson)(\\.sys)?\\.ini', true, true);
     foreach ($files as $file) {
         if (preg_match('#\\.sys\\.ini#is', $file)) {
             if (preg_match('#\\.com_jcomments\\.sys\\.ini#is', $file)) {
                 $content = JFile::read($file);
                 $content = self::_replaceCommentsAndQuotes($content);
                 $content = str_replace('COM_JCOMMENTS_', 'COM_JCOMMENTS.', $content);
                 $content = str_replace('COM_JCOMMENTS.COMMENTS_VIEW_', 'COM_JCOMMENTS_COMMENTS_VIEW_', $content);
                 $content = str_replace('COM_JCOMMENTS.BASIC_', 'COM_JCOMMENTS_BASIC_', $content);
                 JFile::write(str_replace('.sys.', '.menu.', $file), $content);
             }
             JFile::delete($file);
         } else {
             $content = JFile::read($file);
             $content = self::_replaceCommentsAndQuotes($content);
             JFile::write($file, $content);
         }
     }
 }
Example #11
0
 static function _log($item, $prepend = "")
 {
     global $jTips, $mosConfig_absolute_path;
     $file_path = $mosConfig_absolute_path . "/components/com_jtips/jtips.log";
     $level = empty($prepend) ? 'INFO' : strtoupper($prepend);
     if (isset($jTips['DebugLevel']) and !in_array($level, $jTips['DebugLevel'])) {
         return true;
     }
     if (isJoomla15()) {
         jimport('joomla.filesystem.file');
         if (JFile::exists($file_path)) {
             $size = filesize($file_path);
             $human = round($size / (1024 * 1024), 4);
             if ($human >= 10) {
                 if (JFile::exists($file_path . ".0")) {
                     JFile::delete($file_path . ".0");
                 }
                 JFile::move($file_path, $file_path . ".0");
             }
         }
     } else {
         if (file_exists($file_path)) {
             $size = filesize($file_path);
             $human = round($size / (1024 * 1024), 4);
             if ($human >= 10) {
                 if (file_exists($file_path . ".0")) {
                     @unlink($file_path . ".0");
                 }
                 @rename($file_path, $file_path . ".0");
             }
         }
     }
     if (!empty($prepend) and is_string($prepend)) {
         $prepend .= " ";
     }
     $log = "jLOG " . gmdate('Y-m-d H:i:s') . ": " . $prepend . stripslashes(print_r($item, true)) . "\n";
     if (isJoomla15()) {
         $data = '';
         if (JFile::exists($file_path)) {
             $data = JFile::read($file_path);
             $data .= $log;
         }
         return JFile::write($file_path, $data);
     } else {
         if (!($handle = fopen($file_path, 'a'))) {
             jTipsLogger::jTipsDebug("FAILED TO OPEN LOG FILE!", false);
         } else {
             if (fwrite($handle, $log) === false) {
                 jTipsLogger::jTipsDebug("FAILED TO WRITE TO LOG FILE!", false);
                 return false;
             }
             return fclose($handle);
         }
     }
 }
Example #12
0
 function install($parent)
 {
     jimport('joomla.filesystem.file');
     $src = dirname(__FILE__) . DS . 'admin' . DS . 'cron' . DS . 'update_lowfares.php';
     $dest = JPATH_ROOT . DS . 'cli' . DS . 'update_lowfares.php';
     if (!JFile::move($src, $dest)) {
         echo '<span style="color: red;">ERROR: no se pudo copiar el archivo del CRON necesario pora Actualizar las mejores tarifas.</span>';
     } else {
         echo '<span style="color: #090;">**Recuerda que debes agregar al CRON el archivo ubicado en /cli/update_lowfares.php, para pasar la certificacion de P2P</span>';
     }
 }
/**
 * Installs and publishes JWF system core plugin, Both under J! 1.5 and J! 1.6
 * 
 * @access	public
 */
function com_install()
{
    list($major, $minor, $version) = explode('.', JVERSION);
    if ($major == 1 && $minor == 5) {
        $db =& JFactory::getDBO();
        /*					Install plugin 					*/
        if (!JFile::exists(JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.php')) {
            JFile::move(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system' . DS . 'jwf.php', JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.php');
            JFile::move(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system' . DS . 'jwf.xml', JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.xml');
            JFile::move(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system' . DS . 'jwf.cron.php', JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.cron.php');
        }
        JFolder::delete(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system');
        $query = 'SELECT `published` FROM `#__plugins` WHERE `element`="jwf"';
        $db->setQuery($query);
        $result = $db->loadObject();
        if ($result == null) {
            $query = "INSERT INTO `#__plugins` ( `name`, `element`, `folder`, `access`, `ordering`, `published`, `iscore`, `client_id`, `checked_out`, `checked_out_time`, `params`)" . "\nVALUES" . "\n('System - JWF', 'jwf', 'system', 0, 0, 1, 0, 0, 0, '0000-00-00 00:00:00', '')";
            $db->setQuery($query);
            $db->query();
        } else {
            $query = 'UPDATE `#__plugins` SET `published` = 1 WHERE `element`="jwf"';
            $db->setQuery($query);
            $db->query();
        }
        /*					Done installing plugin					*/
        $db->setQuery("UPDATE #__components SET admin_menu_img='../media/com_jwf/images/logo-16.png' WHERE admin_menu_link='option=com_jwf'");
        $res = $db->query();
    }
    if ($major == 1 && $minor == 6) {
        $db =& JFactory::getDBO();
        /*					Install plugin 					*/
        if (!JFile::exists(JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.php')) {
            JFile::move(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system' . DS . 'jwf.php', JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.php');
            JFile::move(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system' . DS . 'jwf.xml', JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.xml');
            JFile::move(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system' . DS . 'jwf.cron.php', JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jwf.cron.php');
        }
        JFolder::delete(JWF_BACKEND_PATH . DS . 'plugins' . DS . 'system');
        $query = 'SELECT `enabled` FROM `#__extensions` WHERE `type`="plugin" AND `element`="jwf"';
        $db->setQuery($query);
        $result = $db->loadObject();
        if ($result == null) {
            $query = "INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`)" . "\nVALUES" . "\n( 'System - JWF', 'plugin', 'jwf', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 1, 0)";
            $db->setQuery($query);
            $db->query();
        } else {
            $query = 'UPDATE `#__extensions` SET `enabled`=1 WHERE `type`="plugin" AND `element`="jwf"';
            $db->setQuery($query);
            $db->query();
        }
        /*					Done installing plugin					*/
        $db->setQuery("UPDATE #__components SET admin_menu_img='../media/com_jwf/images/logo-16.png' WHERE admin_menu_link='option=com_jwf'");
        $res = $db->query();
    }
}
Example #14
0
 function postflight($type, $parent)
 {
     // Rename manifest file
     $path = $parent->getParent()->getPath('extension_root');
     $name = $parent->get('name');
     if (JFile::exists("{$path}/{$name}.j25.xml")) {
         if (JFile::exists("{$path}/{$name}.xml")) {
             JFile::delete("{$path}/{$name}.xml");
         }
         JFile::move("{$path}/{$name}.j25.xml", "{$path}/{$name}.xml");
     }
 }
Example #15
0
 private function installCrawler($parent)
 {
     $success = false;
     $src = $parent->getParent()->getPath('extension_administrator') . '/cli/jharvest.php';
     $cli = JPATH_ROOT . '/cli/jharvest.php';
     if (JFile::exists($src)) {
         if ($success = JFile::move($src, $cli)) {
             JFolder::delete($parent->getParent()->getPath('extension_administrator') . '/cli');
         }
     }
     return $success;
 }
 public static function revertCARootFileToOriginal()
 {
     // Get the original Joomla file
     $joomlaCACertificatesPath = JPATH_SITE . '/libraries/joomla/http/transport/cacert.pem';
     $backupCACertificatesPath = JPATH_SITE . '/libraries/joomla/http/transport/cacert.pem.ossystem-backup';
     if (file_exists($backupCACertificatesPath)) {
         if (file_exists($joomlaCACertificatesPath)) {
             JFile::delete($joomlaCACertificatesPath);
         }
         JFile::move($backupCACertificatesPath, $joomlaCACertificatesPath);
     }
 }
/**
 * @brief Instala las librerias de javascript, comun a diferentes componentes
 */
function installJS()
{
    $folder = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_rotator' . DS . 'library' . DS . 'js' . DS;
    $dest = JPATH_SITE . DS . 'media' . DS . 'system' . DS . 'js' . DS;
    global $_reources;
    $_reources = '<h4>Recusrsos instalados:</h4>';
    foreach (JFolder::files($folder) as $file) {
        if (!JFile::exists($dest . $file)) {
            JFile::move($folder . $file, $dest . $file);
            $_reources .= "<span style='padding: 0 7px;'></span>" . $file . "<br />";
        }
    }
}
Example #18
0
 public function postflight($type, $parent)
 {
     //If type is install
     if ($type == 'install') {
         //Move library file to Joomla libraries and delete it from plugin
         JFolder::move(JPATH_SITE . '/plugins/api/easyblog/libraries/simpleschema', JPATH_SITE . '/libraries/simpleschema');
         JFolder::delete(JPATH_SITE . '/plugins/api/easyblog/libraries');
         //Move helper file to easyblog helpers and delete it from plugin
         JFile::move(JPATH_SITE . '/plugins/api/easyblog/components/com_easyblog/helpers/simpleschema.php', JPATH_SITE . '/components/com_easyblog/helpers/simpleschema.php');
         JFolder::delete(JPATH_SITE . '/plugins/api/easyblog/components');
     }
     return true;
 }
 /**
  * @param string $type
  * @param JInstallerComponent $adapter
  */
 function preflight($type, $adapter)
 {
     $path = $adapter->getParent()->getPath('source');
     $xmldest = $path . '/mobilejoomla.xml';
     $xmlsrc = $path . '/mobilejoomla.j2x.xml';
     if (JFile::exists($xmlsrc)) {
         if (JFile::exists($xmldest)) {
             JFile::delete($xmldest);
         }
         JFile::move($xmlsrc, $xmldest);
     }
     $adapter->getParent()->setPath('manifest', $xmldest);
 }
Example #20
0
 function postflight($type, $parent)
 {
     // Run only in Joomla 1.6+
     $installer = $parent->getParent();
     // Rename kunena.j16.xml to kunena.xml
     $adminpath = KPATH_ADMIN;
     if (JFile::exists("{$adminpath}/kunena.j16.xml")) {
         if (JFile::exists("{$adminpath}/kunena.xml")) {
             JFile::delete("{$adminpath}/kunena.xml");
         }
         JFile::move("{$adminpath}/kunena.j16.xml", "{$adminpath}/kunena.xml");
     }
     $installer->set('redirect_url', JURI::base() . 'index.php?option=com_kunena&view=install');
 }
Example #21
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 #22
0
function com_install()
{
    global $installer_object;
    if (!isset($installer_object) || version_compare(JVERSION, '1.6', '>')) {
        JFactory::getApplication()->enqueueMessage('Oops, Joomla! 1.5 manifest file loaded! Aborting installation.', 'notice');
        return false;
    }
    // Check requirements.
    require_once dirname(__FILE__) . '/install.script.php';
    $installer = new Com_KunenaInstallerScript();
    $version = $installer_object->manifest->getElementByPath('version');
    if (!$installer->checkRequirements($version->data())) {
        return false;
    }
    $adminpath = JPATH_ADMINISTRATOR . '/components/com_kunena';
    // Remove old manifest files.
    $manifests = array('manifest.xml', 'kunena.j16.xml');
    foreach ($manifests as $filename) {
        if (JFile::exists("{$adminpath}/{$filename}")) {
            JFile::delete("{$adminpath}/{$filename}");
        }
    }
    // Create new bootstrap file for the installer and keep backup from the old version.
    if (JFile::exists("{$adminpath}/admin.kunena.php")) {
        $backuppath = "{$adminpath}/bak";
        if (JFolder::exists($backuppath)) {
            JFolder::delete($backuppath);
        }
        if (!JFolder::create($backuppath)) {
            return false;
        }
        $contents = file_get_contents("{$adminpath}/admin.kunena.php");
        if (!strstr($contents, '/* KUNENA FORUM INSTALLER */')) {
            JFile::move("{$adminpath}/admin.kunena.php", "{$backuppath}/admin.kunena.php");
        }
    }
    $success = JFile::copy("{$adminpath}/install/entrypoints/admin.kunena.php", "{$adminpath}/admin.kunena.php");
    if (!$success) {
        return false;
    }
    // Reset installer state.
    $app = JFactory::getApplication();
    $app->setUserState('kunena-old', 0);
    // This isn't called because of redirect.
    $installer_object->parent->copyManifest();
    // Redirect to Kunena Installer.
    $redirect_url = JURI::base() . 'index.php?option=com_kunena';
    header("HTTP/1.1 303 See Other");
    header("Location: {$redirect_url}");
}
	/**
	 * method to preflight the update of this plugin
	 *
	 * @param	string                   $type    'update' or 'install'
	 * @param	JInstallerAdapterPlugin  $parent  The class calling this method
	 * @return void
	 */
	public function preflight( /** @noinspection PhpUnusedParameterInspection */ $type, $parent )
	{
		$element	=	'cbpaidsubsbot';
		$installer	=	$parent->getParent();
		$adminPath	=	$installer->getPath( 'source' );

		if ( JFile::exists( $adminPath . '/' . $element . '.j16.xml' ) ) {
			if ( JFile::exists( $adminPath . '/' . $element . '.xml' ) ) {
				JFile::delete( $adminPath . '/' . $element . '.xml' );
			}

			JFile::move( $adminPath . '/' . $element . '.j16.xml', $adminPath . '/' . $element . '.xml' );
			$installer->setPath( 'manifest', $adminPath . '/' . $element . '.xml' );
		}
	}
Example #24
0
 /**
  * Copies the CLI scripts into Joomla!'s cli directory
  *
  * @param JInstaller $parent
  */
 private function _copyCliFiles($parent)
 {
     $src = $parent->getParent()->getPath('source');
     if (empty($this->eventgalleryCliScripts)) {
         return;
     }
     foreach ($this->eventgalleryCliScripts as $script) {
         if (JFile::exists(JPATH_ROOT . '/cli/' . $script)) {
             JFile::delete(JPATH_ROOT . '/cli/' . $script);
         }
         if (JFile::exists($src . '/cli/' . $script)) {
             JFile::move($src . '/cli/' . $script, JPATH_ROOT . '/cli/' . $script);
         }
     }
 }
 public function install(JAdapterInstance $adapter)
 {
     $lib = $adapter->getParent()->getPath('source') . '/library/';
     $installer = new JInstaller();
     $installer->install($lib);
     $src = $adapter->getParent()->getPath('source');
     foreach ($this->cli as $script) {
         if (JFile::exists(JPATH_ROOT . '/cli/' . $script)) {
             JFile::delete(JPATH_ROOT . '/cli/' . $script);
         }
         if (JFile::exists($src . '/cli/' . $script)) {
             JFile::move($src . '/cli/' . $script, JPATH_ROOT . '/cli/' . $script);
         }
     }
 }
Example #26
0
 function uncopyHackedFiles()
 {
     $filestoreplace = XiptHelperInstall::_getJSPTFileList();
     if ($filestoreplace) {
         foreach ($filestoreplace as $sourceFile => $targetFile) {
             $targetFileBackup = $targetFile . '.jxibak';
             // delete this file
             // Only delete if you have backup copy
             if (JFile::exists($targetFile) && JFile::exists($targetFileBackup)) {
                 JFile::delete($targetFile);
                 JFile::move($targetFileBackup, $targetFile) || XiptError::raiseError('XIPT-UNINSTALL-ERROR', 'Not able to restore backup : ' . __LINE__);
             }
         }
     }
     // TODO : also remove previous profiletypes and template library fields files
 }
function com_install()
{
    jimport('joomla.filesystem.file');
    jimport('joomla.filesystem.folder');
    $lang = JFactory::getLanguage();
    $lang->load('com_datsogallery.sys');
    $content = '<html><body bgcolor="#ffffff"></body></html>';
    if (JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_datsogallery' . DS . 'config.datsogallery.php')) {
        JFile::delete(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_datsogallery' . DS . 'config.datsogallery.bak');
    } else {
        JFile::move(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_datsogallery' . DS . 'config.datsogallery.bak', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_datsogallery' . DS . 'config.datsogallery.php');
    }
    if (!JFolder::exists(JPATH_ROOT . DS . 'zipimport')) {
        JFolder::create(JPATH_ROOT . DS . 'zipimport');
        JFile::write(JPATH_ROOT . DS . 'zipimport' . DS . 'index.html', $content);
    }
    if (!JFolder::exists(JPATH_ROOT . DS . 'images' . DS . 'dg_originals')) {
        JFolder::create(JPATH_ROOT . DS . 'images' . DS . 'dg_originals');
        JFile::write(JPATH_ROOT . DS . 'images' . DS . 'dg_originals' . DS . 'index.html', $content);
    }
    ?>
<div style='display:block;margin:20px auto;width:300px;border:1px solid #CCC;
background:#F8F8FF;-webkit-border-radius: 5px;-moz-border-radius: 5px;
border-radius: 5px;-moz-box-shadow: 0 0 5px #888;
-webkit-box-shadow: 0 0 5px#888;box-shadow: 0 0 5px #888;'>
<div style='padding:20px'>
  <p style='text-align:left'>
  <img src='components/com_datsogallery/images/datsogallery-box.png'
  alt="datsogallery box" /></p>
  <p><?php 
    echo JText::_('COM_DATSOGALLERY_INSTALL_DESC');
    ?>
</p>
  <p style='color:DimGray'>
  <?php 
    echo JText::_('COM_DATSOGALLERY_INSTALL_VERSION');
    ?>
 1.14</p>
  <p><h1><?php 
    echo JText::_('COM_DATSOGALLERY_INSTALL_FINISHED');
    ?>
</h1></p>
  <p>&copy; 2006-2011 <a href="http://www.datso.fr">Andrey Datso</a></p>
  </div>
</div>
<?php 
}
 /**
  * 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)
 {
     $src = JPATH_SITE . "/plugins/system/pftaskexpirynotifier/cron_pf_notifier.php";
     $dest = JPATH_SITE . "/cli/cron_pf_notifier.php";
     if (strtolower($route) == 'install') {
         // Get the XML manifest data
         $manifest = $adapter->get('manifest');
         // Get plugin published state
         $name = $manifest->name;
         $state = isset($manifest->published) ? (int) $manifest->published : 0;
         if (!$state) {
             $state = 1;
             $this->_publishPlugin($name, $state);
         }
         //let's move the cron file into Joomla's cli directory.
         JFile::move($src, $dest);
     }
     return true;
 }
Example #29
0
 function install()
 {
     acymailing_increasePerf();
     $newConfig = new stdClass();
     $newConfig->installcomplete = 1;
     $config = acymailing_config();
     $updateHelper = acymailing_get('helper.update');
     if (!$config->save($newConfig)) {
         $updateHelper->installTables();
         return;
     }
     jimport('joomla.filesystem.folder');
     $frontLanguages = JFolder::folders(JPATH_ROOT . DS . 'language', '-');
     $backLanguages = JFolder::folders(JPATH_ADMINISTRATOR . DS . 'language', '-');
     $installedLanguages = array_unique(array_merge($frontLanguages, $backLanguages));
     if (($key = array_search('en-GB', $installedLanguages)) !== false) {
         unset($installedLanguages[$key]);
     }
     if (!empty($installedLanguages)) {
         $langText = JText::_('ACY_INSTALL_LANGUAGES');
         if ($langText == 'ACY_INSTALL_LANGUAGES') {
             $langText = 'Click here to install the new language files';
         }
         JHTML::_('behavior.modal', 'a.modal');
         acymailing_display('<a class="modal btn" rel="{handler: \'iframe\', size: {x: 600, y: 250}}" href="' . JURI::base() . 'index.php?option=com_acymailing&ctrl=file&task=installLanguages&tmpl=component&languages=' . implode(',', $installedLanguages) . '">' . $langText . '</a>', 'info');
     }
     $updateHelper->initList();
     $updateHelper->installTemplates();
     $updateHelper->installNotifications();
     $updateHelper->installMenu();
     $updateHelper->installExtensions();
     $updateHelper->installBounceRules();
     $updateHelper->fixDoubleExtension();
     $updateHelper->addUpdateSite();
     $updateHelper->fixMenu();
     if (ACYMAILING_J30) {
         JFile::move(ACYMAILING_BACK . 'acymailing_j3.xml', ACYMAILING_BACK . 'acymailing.xml');
     }
     acymailing_setTitle('AcyMailing', 'acymailing', 'dashboard');
     $this->_iframe(ACYMAILING_UPDATEURL . 'install&fromversion=' . JRequest::getCmd('fromversion'));
 }
Example #30
0
 public static function finalize($output)
 {
     if ($output->compression == 'zip') {
         require_once JPATH_ADMINISTRATOR . '/components/com_cck/helpers/pclzip/pclzip.lib.php';
         $tmp = $output->path . '/' . $output->name . '.zip';
         $archive = new PclZip($tmp);
         if ($archive->create($output->root, PCLZIP_OPT_REMOVE_PATH, $output->root) == 0) {
             return false;
         }
         $ext = '.zip';
     } else {
         $ext = '.' . $extension;
     }
     if (JFile::exists($tmp)) {
         $file = $output->output_path . '/' . $output->name . $output->suffix . $ext;
         JFile::move($tmp, $file);
         if (JFolder::exists($output->path)) {
             JFolder::delete($output->path);
         }
         return $file;
     }
     return false;
 }