english/administrator/components/com_config/models/application.php
/**
	 * Method to unset the root_user value from configuration data.
	 *
	 * This method will load the global configuration data straight from
	 * JConfig and remove the root_user value for security, then save the configuration.
	 *
	 * @since	1.6
	 */
Method to unset the root_user value from configuration data.
This method will load the global configuration data straight from
JConfig and remove the root_user value for security, then save the configuration.


Method to unset the root_user value from configuration data . This method will load the global configuration data straight from JConfig and remove the root_user value for security then save the configuration .
function removeroot()
	{
		jimport('joomla.client.helper');
		$prev = new JConfig();
		$prev = JArrayHelper::fromObject($prev);
		if ($prev['caching']) {
			$cache = JFactory::getCache();
			$cache->clean();
		}
		$config = new JRegistry('config');
		unset($prev['root_user']);
		$config->loadArray($prev);
		jimport('joomla.filesystem.path');
		jimport('joomla.filesystem.file');
		$file = JPATH_CONFIGURATION . '/configuration.php';
		$temp = JFactory::getConfig();
		$temp->set('ftp_enable', $prev['ftp_enable']);
		$temp->set('ftp_host', $prev['ftp_host']);
		$temp->set('ftp_port', $prev['ftp_port']);
		$temp->set('ftp_user', $prev['ftp_user']);
		$temp->set('ftp_pass', $prev['ftp_pass']);
		$temp->set('ftp_root', $prev['ftp_root']);
		$ftp = JClientHelper::getCredentials('ftp', true);
		if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
			JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
		}
		if (!JFile::write($file, $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false)))) {
			$this->setError(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'));
			return false;
		}
		if ($prev['ftp_enable'] == 0 && !$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
			JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
		}
		return true;
	}
function removeroot ( ) { jimport ( 'joomla.client.helper' ) ; $ prev = new JConfig ( ) ; $ prev = JArrayHelper :: fromObject ( $ prev ) ; if ( $ prev [ 'caching' ] ) { $ cache = JFactory :: getCache ( ) ; $ cache -> clean ( ) ; } $ config = new JRegistry ( 'config' ) ; unset ( $ prev [ 'root_user' ] ) ; $ config -> loadArray ( $ prev ) ; jimport ( 'joomla.filesystem.path' ) ; jimport ( 'joomla.filesystem.file' ) ; $ file = JPATH_CONFIGURATION . '/configuration.php' ; $ temp = JFactory :: getConfig ( ) ; $ temp -> set ( 'ftp_enable' , $ prev [ 'ftp_enable' ] ) ; $ temp -> set ( 'ftp_host' , $ prev [ 'ftp_host' ] ) ; $ temp -> set ( 'ftp_port' , $ prev [ 'ftp_port' ] ) ; $ temp -> set ( 'ftp_user' , $ prev [ 'ftp_user' ] ) ; $ temp -> set ( 'ftp_pass' , $ prev [ 'ftp_pass' ] ) ; $ temp -> set ( 'ftp_root' , $ prev [ 'ftp_root' ] ) ; $ ftp = JClientHelper :: getCredentials ( 'ftp' , true ) ; if ( ! $ ftp [ 'enabled' ] && JPath :: isOwner ( $ file ) && ! JPath :: setPermissions ( $ file , '0644' ) ) { JError :: raiseNotice ( 'SOME_ERROR_CODE' , JText :: _ ( 'COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE' ) ) ; } if ( ! JFile :: write ( $ file , $ config -> toString ( 'PHP' , array ( 'class' => 'JConfig' , 'closingtag' => false ) ) ) ) { $ this -> setError ( JText :: _ ( 'COM_CONFIG_ERROR_WRITE_FAILED' ) ) ; return false ; } if ( $ prev [ 'ftp_enable' ] == 0 && ! $ ftp [ 'enabled' ] && JPath :: isOwner ( $ file ) && ! JPath :: setPermissions ( $ file , '0444' ) ) { JError :: raiseNotice ( 'SOME_ERROR_CODE' , JText :: _ ( 'COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE' ) ) ; } return true ; }
Method to unset the root_user value from configuration data.
Method to unset the root_user value from configuration data .
// Include client helper // Get the previous configuration. // Clean the cache if disabled but previously enabled. // Create the new configuration object, and unset the root_user property /*
		 * Write the configuration file.
		 */ // Set the configuration file path. // Overwrite the old FTP credentials with the new ones. // Get the new FTP credentials. // Attempt to make the file writeable if using FTP. // Attempt to write the configuration file as a PHP class named JConfig. // Attempt to make the file unwriteable if using FTP.