<commit_before><?php
/**
 * @version		$Id$
 * @category	Nooku
 * @package		Nooku_Server
 * @subpackage	Users
 * @copyright	Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Component Dispatcher
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @category	Nooku
 * @package		Nooku_Server
 * @subpackage	Users
 */
class ComUsersDispatcher extends ComDefaultDispatcher
{
    protected function _actionDispatch(KCommandContext $context)
	{        	
        if(KFactory::get('lib.joomla.user')->guest) 
        {  
            if(KRequest::method() == KHttpRequest::GET) 
            {
                //Force the view to prevent a redirect
                KRequest::set('get.view', 'login');
                
                //Force the view to login
                $this->view = 'login';
            }
        } 
        else 
        {
            //Redirect if user is already logged in
            if($this->getRequest()->view == 'login') {
                KFactory::get('lib.joomla.application')->redirect('index.php');
            }
        }
	           
        return parent::_actionDispatch($context);
	}
}<commit_msg>Cleanup<commit_after><?php
/**
 * @version		$Id$
 * @category	Nooku
 * @package		Nooku_Server
 * @subpackage	Users
 * @copyright	Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Component Dispatcher
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/gergoerdosi>
 * @category	Nooku
 * @package		Nooku_Server
 * @subpackage	Users
 */
class ComUsersDispatcher extends ComDefaultDispatcher
{
    protected function _initialize(KConfig $config)
    {  
        if(KFactory::get('lib.joomla.user')->guest) 
        {  
            if(KRequest::method() == KHttpRequest::GET) 
            {
                //Force the view to prevent a redirect
                KRequest::set('get.view', 'login');
                
                $config->controller = 'login';
            }
        } 
        
        parent::_initialize($config);
    }
    
    protected function _actionDispatch(KCommandContext $context)
	{        	
        if(!KFactory::get('lib.joomla.user')->guest) 
        {  
            //Redirect if user is already logged in
            if($this->getRequest()->view == 'login') {
                KFactory::get('lib.joomla.application')->redirect('index.php');
            }
        } 
               
        return parent::_actionDispatch($context);
	}
}
{'fraction_non_alphanumeric': 0.13785394932935915, 'fraction_numerical': 0.0037257824143070045, 'mean_word_length': 1.9833333333333334, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4149248', 'n_tokens_mistral': 843, 'n_tokens_neox': 808, 'n_words': 150}