<commit_before><?php

/**
 * A class representing the /site/ pages in the application.
 */
class SiteController extends Controller
{
	/**
	 * Declares class-based actions.
	 */
	public function actions()
	{
		return array(
			// page action renders "static" pages stored under 'protected/views/site/pages'
			'page'=>array(
				'class'=>'CViewAction',
			),
		);
	}


	/**
	 * @return array action filters
	 */
	public function filters()
	{
		return array(
			'checkDebugMode + dummyLogin, dummyAdminLogin', // check debug mode
		);
	}

	/**
	 * This is the default 'index' action that is invoked
	 * when an action is not explicitly requested by users.
	 */
	public function actionIndex()
	{
		$this->render('index', array('model'=>Testimonial::getCurrentTestimonial()));
	}

	/**
	 * This is the action to handle external exceptions.
	 */
	public function actionError()
	{
		if($error=Yii::app()->errorHandler->error)
		{
			if(Yii::app()->request->isAjaxRequest)
				echo $error['message'];
			else
				$this->render('error', $error);
		}
	}

	/**
	 * Displays the login page
	 */
	public function actionLogin()
	{
		Yii::import('application.vendors.CAS.*');

		include_once('CAS/Autoload.php');
		spl_autoload_unregister(array('YiiBase', 'autoload'));
		spl_autoload_register(array('YiiBase', 'autoload'));
		include_once('CAS.php');

		phpCAS::setDebug();
		phpCAS::client(CAS_VERSION_2_0, 'sso.ui.ac.id', 443, 'cas');
		phpCAS::setNoCasServerValidation();
		phpCAS::forceAuthentication();
		phpCAS::checkAuthentication();
		
		$username = phpCAS::getUser();
		$identity = new UserIdentity($username);

		if ($identity->authenticate())
			Yii::app()->user->login($identity);

		$this->redirect(array('home/index'));
	}

	/**
	 * Logs in as a dummy user.
	 */
	public function actionDummyLogin()
	{
		$identity = new DummyUserIdentity(0);

		if ($identity->authenticate())
			Yii::app()->user->login($identity);

		$this->redirect(array('home/index'));
	}

	/**
	 * Logs in as a dummy admin
	 */
	public function actionDummyAdminLogin()
	{
		$identity = new DummyUserIdentity(1);

		if ($identity->authenticate())
			Yii::app()->user->login($identity);

		$this->redirect(array('home/index'));
	}

	/**
	 * Logs out the current user and redirects to homepage.
	 */
	public function actionLogout()
	{
		Yii::import('application.vendors.CAS.*');
		
		include_once('CAS/Autoload.php');
		spl_autoload_unregister(array('YiiBase', 'autoload'));
		spl_autoload_register(array('YiiBase', 'autoload'));
		include_once('CAS.php');

		phpCAS::setDebug();
		phpCAS::client(CAS_VERSION_2_0, 'sso.ui.ac.id', 443, 'cas');
		phpCAS::setNoCasServerValidation();
		phpCAS::logout();
		
		Yii::app()->user->logout();
		$this->redirect(Yii::app()->homeUrl);
	}

	/**
	 * Logs out dummy user.
	 */
	public function actionDummyLogout()
	{
		Yii::app()->user->logout();
		$this->redirect(Yii::app()->homeUrl);
	}


	/**
	 * A filter to ensure that an action only available in debug mode.
	 * @param  CFilterChain $filterChain the filter chain
	 */
	public function filterCheckDebugMode($filterChain)
	{
		if (defined('YII_DEBUG'))
			throw new CHttpException(404);

		$filterChain->run();
	}
}<commit_msg>Membetulkan bug dummy login<commit_after><?php

/**
 * A class representing the /site/ pages in the application.
 */
class SiteController extends Controller
{
	/**
	 * Declares class-based actions.
	 */
	public function actions()
	{
		return array(
			// page action renders "static" pages stored under 'protected/views/site/pages'
			'page'=>array(
				'class'=>'CViewAction',
			),
		);
	}


	/**
	 * @return array action filters
	 */
	public function filters()
	{
		return array(
			'checkDebugMode + dummyLogin, dummyAdminLogin', // check debug mode
		);
	}

	/**
	 * This is the default 'index' action that is invoked
	 * when an action is not explicitly requested by users.
	 */
	public function actionIndex()
	{
		$this->render('index', array('model'=>Testimonial::getCurrentTestimonial()));
	}

	/**
	 * This is the action to handle external exceptions.
	 */
	public function actionError()
	{
		if($error=Yii::app()->errorHandler->error)
		{
			if(Yii::app()->request->isAjaxRequest)
				echo $error['message'];
			else
				$this->render('error', $error);
		}
	}

	/**
	 * Displays the login page
	 */
	public function actionLogin()
	{
		Yii::import('application.vendors.CAS.*');

		include_once('CAS/Autoload.php');
		spl_autoload_unregister(array('YiiBase', 'autoload'));
		spl_autoload_register(array('YiiBase', 'autoload'));
		include_once('CAS.php');

		phpCAS::setDebug();
		phpCAS::client(CAS_VERSION_2_0, 'sso.ui.ac.id', 443, 'cas');
		phpCAS::setNoCasServerValidation();
		phpCAS::forceAuthentication();
		phpCAS::checkAuthentication();
		
		$username = phpCAS::getUser();
		$identity = new UserIdentity($username);

		if ($identity->authenticate())
			Yii::app()->user->login($identity);

		$this->redirect(array('home/index'));
	}

	/**
	 * Logs in as a dummy user.
	 */
	public function actionDummyLogin()
	{
		$identity = new DummyUserIdentity(0);

		if ($identity->authenticate())
			Yii::app()->user->login($identity);

		$this->redirect(array('home/index'));
	}

	/**
	 * Logs in as a dummy admin
	 */
	public function actionDummyAdminLogin()
	{
		$identity = new DummyUserIdentity(1);

		if ($identity->authenticate())
			Yii::app()->user->login($identity);

		$this->redirect(array('home/index'));
	}

	/**
	 * Logs out the current user and redirects to homepage.
	 */
	public function actionLogout()
	{
		Yii::import('application.vendors.CAS.*');
		
		include_once('CAS/Autoload.php');
		spl_autoload_unregister(array('YiiBase', 'autoload'));
		spl_autoload_register(array('YiiBase', 'autoload'));
		include_once('CAS.php');

		phpCAS::setDebug();
		phpCAS::client(CAS_VERSION_2_0, 'sso.ui.ac.id', 443, 'cas');
		phpCAS::setNoCasServerValidation();
		phpCAS::logout();
		
		Yii::app()->user->logout();
		$this->redirect(Yii::app()->homeUrl);
	}

	/**
	 * Logs out dummy user.
	 */
	public function actionDummyLogout()
	{
		Yii::app()->user->logout();
		$this->redirect(Yii::app()->homeUrl);
	}


	/**
	 * A filter to ensure that an action only available in debug mode.
	 * @param  CFilterChain $filterChain the filter chain
	 */
	public function filterCheckDebugMode($filterChain)
	{
		if ( ! defined('YII_DEBUG'))
			throw new CHttpException(404);

		$filterChain->run();
	}
}
{'fraction_non_alphanumeric': 0.17352526991081207, 'fraction_numerical': 0.004694101079643249, 'mean_word_length': 4.15483870967742, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4879135', 'n_tokens_mistral': 2402, 'n_tokens_neox': 2092, 'n_words': 433}