english/administrator/components/com_users/controllers/config.php
/**
	 * Method to import the configuration via string or upload.
	 *
	 * @return	bool	True on success, false on failure.
	 * @since	1.0
	 */
Method to import the configuration via string or upload.
@return      bool    True on success, false on failure.
Method to import the configuration via string or upload . @return bool True on success false on failure .
public function import()
	{
		JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
		$string = JRequest::getVar('configString', '', 'post', 'string', JREQUEST_ALLOWHTML);
		$file	= JRequest::getVar('configFile', array(), 'files', 'array');
		$return	= null;
		if (!empty($file) && ($file['error'] == 0) && ($file['size'] > 0) && (is_readable($file['tmp_name'])))
		{
			$string = implode("\n", file($file['tmp_name']));
			$model	= $this->getModel('Config');
			$return	= $model->import($string);
		}
		elseif (strlen($string) > 1)
		{
			$model	= $this->getModel('Config');
			$return	= $model->import($string);
		}
		if ($return === false)
		{
			$message = JText::sprintf('COM_USERS_CONFIG_IMPORT_FAILED', $model->getError());
			$this->setRedirect('index.php?option=com_users&view=config&layout=import&tmpl=component', $message, 'notice');
			return false;
		}
		else
		{
			$this->setRedirect('index.php?option=com_users&view=config&layout=close&tmpl=component');
			return true;
		}
	}
public function import ( ) { JRequest :: checkToken ( ) or jexit ( JText :: _ ( 'JINVALID_TOKEN' ) ) ; $ string = JRequest :: getVar ( 'configString' , '' , 'post' , 'string' , JREQUEST_ALLOWHTML ) ; $ file = JRequest :: getVar ( 'configFile' , array ( ) , 'files' , 'array' ) ; $ return = null ; if ( ! empty ( $ file ) && ( $ file [ 'error' ] == 0 ) && ( $ file [ 'size' ] > 0 ) && ( is_readable ( $ file [ 'tmp_name' ] ) ) ) { $ string = implode ( " \n " , file ( $ file [ 'tmp_name' ] ) ) ; $ model = $ this -> getModel ( 'Config' ) ; $ return = $ model -> import ( $ string ) ; } elseif ( strlen ( $ string ) > 1 ) { $ model = $ this -> getModel ( 'Config' ) ; $ return = $ model -> import ( $ string ) ; } if ( $ return === false ) { $ message = JText :: sprintf ( 'COM_USERS_CONFIG_IMPORT_FAILED' , $ model -> getError ( ) ) ; $ this -> setRedirect ( 'index.php?option=com_users&view=config&layout=import&tmpl=component' , $ message , 'notice' ) ; return false ; } else { $ this -> setRedirect ( 'index.php?option=com_users&view=config&layout=close&tmpl=component' ) ; return true ; } }
Method to import the configuration via string or upload.
Method to import the configuration via string or upload .
// Check for request forgeries. // Get the configuration values from the Request. // Handle the possible import methods. // Handle import via uploaded file. // Handle import via pasted string. // Handle the response.