/** * @return boolean * * @since 3.0 */ function _createConfiguration($options) { // Create a new registry to build the configuration options. $registry = new JRegistry(); /* Site Settings */ $registry->set('offline', $options->site_offline); $registry->set('offline_message', JText::_('INSTL_STD_OFFLINE_MSG')); $registry->set('display_offline_message', 1); $registry->set('offline_image', ''); $registry->set('sitename', $options->site_name); $registry->set('editor', 'tinymce'); $registry->set('captcha', '0'); $registry->set('list_limit', 20); $registry->set('access', 1); /* Debug Settings */ $registry->set('debug', 0); $registry->set('debug_lang', 0); /* Database Settings */ $registry->set('dbtype', $options->db_type); $registry->set('host', $options->db_host); $registry->set('user', $options->db_user); $registry->set('password', $options->db_pass); $registry->set('db', $options->db_name); $registry->set('dbprefix', $options->db_prefix); /* Server Settings */ $registry->set('live_site', ''); $registry->set('secret', JUserHelper::genRandomPassword(16)); $registry->set('gzip', 0); $registry->set('error_reporting', 'default'); $registry->set('helpurl', 'http://help.joomla.org/proxy/index.php?option=com_help&keyref=Help{major}{minor}:{keyref}'); $registry->set('ftp_host', $options->ftp_host); $registry->set('ftp_port', $options->ftp_port); $registry->set('ftp_user', $options->ftp_save ? $options->ftp_user : ''); $registry->set('ftp_pass', $options->ftp_save ? $options->ftp_pass : ''); $registry->set('ftp_root', $options->ftp_save ? $options->ftp_root : ''); $registry->set('ftp_enable', $options->ftp_enable); /* Locale Settings */ $registry->set('offset', 'UTC'); /* Mail Settings */ $registry->set('mailer', 'mail'); $registry->set('mailfrom', $options->admin_email); $registry->set('fromname', $options->site_name); $registry->set('sendmail', '/usr/sbin/sendmail'); $registry->set('smtpauth', 0); $registry->set('smtpuser', ''); $registry->set('smtppass', ''); $registry->set('smtphost', 'localhost'); $registry->set('smtpsecure', 'none'); $registry->set('smtpport', '25'); /* Cache Settings */ $registry->set('caching', 0); $registry->set('cache_handler', 'file'); $registry->set('cachetime', 15); /* Meta Settings */ $registry->set('MetaDesc', $options->site_metadesc); $registry->set('MetaKeys', $options->site_metakeys); $registry->set('MetaTitle', 1); $registry->set('MetaAuthor', 1); $registry->set('MetaVersion', 0); $registry->set('robots', ''); /* SEO Settings */ $registry->set('sef', 1); $registry->set('sef_rewrite', 0); $registry->set('sef_suffix', 0); $registry->set('unicodeslugs', 0); /* Feed Settings */ $registry->set('feed_limit', 10); $registry->set('log_path', JPATH_ROOT . '/logs'); $registry->set('tmp_path', JPATH_ROOT . '/tmp'); /* Session Setting */ $registry->set('lifetime', 15); $registry->set('session_handler', 'database'); // Generate the configuration class string buffer. $buffer = $registry->toString('PHP', array('class' => 'JConfig', 'closingtag' => false)); // Build the configuration file path. $path = JPATH_CONFIGURATION . '/configuration.php'; // Determine if the configuration file path is writable. if (file_exists($path)) { $canWrite = is_writable($path); } else { $canWrite = is_writable(JPATH_CONFIGURATION . '/'); } /* * If the file exists but isn't writable OR if the file doesn't exist and the parent directory * is not writable we need to use FTP */ $useFTP = false; if (file_exists($path) && !is_writable($path) || !file_exists($path) && !is_writable(dirname($path) . '/')) { $useFTP = true; } // Check for safe mode if (ini_get('safe_mode')) { $useFTP = true; } // Enable/Disable override if (!isset($options->ftpEnable) || $options->ftpEnable != 1) { $useFTP = false; } if ($useFTP == true) { // Connect the FTP client jimport('joomla.filesystem.path'); $ftp = installation / models / configuration . php::getInstance($options->ftp_host, $options->ftp_port); $ftp->login($options->ftp_user, $options->ftp_pass); // Translate path for the FTP account $file = JPath::clean(str_replace(JPATH_CONFIGURATION, $options->ftp_root, $path), '/'); // Use FTP write buffer to file if (!$ftp->write($file, $buffer)) { // Set the config string to the session. $session = JFactory::getSession(); $session->set('setup.config', $buffer); } $ftp->quit(); } else { if ($canWrite) { file_put_contents($path, $buffer); $session = JFactory::getSession(); $session->set('setup.config', null); } else { // Set the config string to the session. $session = JFactory::getSession(); $session->set('setup.config', $buffer); } } return true; }