<commit_before><?php
class PasswordController extends Zend_Controller_Action
{
	protected function _getNewPasswordForm($uid = false, $security_code = false)
    {
        $registry = Zend_Registry::getInstance();
        
        $config = $registry->get("config");
        
        static $form = '';
        
        if(!is_object($form))
        {
        	require_once APPLICATION_PATH . '/forms/NewPassword.php';
        	
        	if(!$uid)
        	{
        		$path = Zend_Controller_Front::getInstance()->getRouter()->assemble(array(), "password");
        	} else {
        		$path = Zend_Controller_Front::getInstance()->getRouter()->assemble(array("confirm_uid" => $uid, "security_code" => $security_code), "password_unsigned");
        	}
        	
            $form = new Form_NewPassword(array(
                'action' => ($config->ssl) ? 'https://'.$config->webhostssl . $config->webroot . $path : $config->webroot . $path,
                'method' => 'post',
            ));
            
        }
        return $form;
    }
	
    public function unavailableAction()
    {
    }
    
    public function recoverAction()
    {
        if(Zend_Auth::getInstance()->hasIdentity()) {
			$this->_redirect(Zend_Controller_Front::getInstance()->getRouter()->assemble(array(), "logout") . "?please", array("exit"));
		}
    	
    	$request = $this->getRequest();
    	
    	$registry = Zend_Registry::getInstance();
        $config = $registry->get('config');
        
        $People = ML_People::getInstance();
        $Recover = ML_Recover::getInstance();
        
        $form = $Recover->_getRecoverForm();
        
        if($request->isPost() && $form->isValid($request->getPost()))
        {
        	$find = $form->getValues();
        	
        	$securitycode = sha1(md5(mt_rand(0, 1000).time().$find.microtime()).deg2rad(mt_rand(0,360)));
        	$getUser = $registry->accountRecover; //AccountRecover.php validator who tells
        	
        	$Recover->getAdapter()->query('INSERT INTO `recover` (`uid`, `securitycode`) VALUES (?, ?) ON DUPLICATE KEY UPDATE uid=VALUES(uid), securitycode=VALUES(securitycode), timestamp=CURRENT_TIMESTAMP', array($getUser['id'], $securitycode));
        	
        	$this->view->securitycode = $securitycode;
        	$this->view->recoverUser = $getUser;
        	
        	$this->view->recovering = true;
        	
	        $mail = new Zend_Mail();
			$mail->setBodyText($this->view->render("password/emailRecover.phtml"))
				->setFrom($config->robotEmail->addr, $config->robotEmail->name)
				->addTo($getUser['email'], $getUser['name'])
				->setSubject('Recover your '.$config->application.' account')
				->send();
        }
    	
    	$this->view->recoverForm = $form;
    }
    
    public function passwordAction()
    {
    	$request = $this->getRequest();
    	
    	$auth = Zend_Auth::getInstance();
    	$registry = Zend_Registry::getInstance();
    	
    	$People = ML_People::getInstance();
    	$Credential = ML_Credential::getInstance();
    	$Recover = ML_Recover::getInstance();
    	
    	$params = $request->getParams();
    	
    	$this->view->request = $request;
    	
    	if($auth->hasIdentity())
    	{
    	    if(!isset($params['confirm_uid']) && !isset($params['security_code']))
    	    {
        	    $form = $this->_getNewPasswordForm();
        		$uid = $auth->getIdentity();
    	    	$registry->set("changeUserProperPassword", true);<commit_msg>correcting bug: it was calling $config->application instead of $config->applicationname<commit_after><?php
class PasswordController extends Zend_Controller_Action
{
	protected function _getNewPasswordForm($uid = false, $security_code = false)
    {
        $registry = Zend_Registry::getInstance();
        
        $config = $registry->get("config");
        
        static $form = '';
        
        if(!is_object($form))
        {
        	require_once APPLICATION_PATH . '/forms/NewPassword.php';
        	
        	if(!$uid)
        	{
        		$path = Zend_Controller_Front::getInstance()->getRouter()->assemble(array(), "password");
        	} else {
        		$path = Zend_Controller_Front::getInstance()->getRouter()->assemble(array("confirm_uid" => $uid, "security_code" => $security_code), "password_unsigned");
        	}
        	
            $form = new Form_NewPassword(array(
                'action' => ($config->ssl) ? 'https://'.$config->webhostssl . $config->webroot . $path : $config->webroot . $path,
                'method' => 'post',
            ));
            
        }
        return $form;
    }
	
    public function unavailableAction()
    {
    }
    
    public function recoverAction()
    {
        if(Zend_Auth::getInstance()->hasIdentity()) {
			$this->_redirect(Zend_Controller_Front::getInstance()->getRouter()->assemble(array(), "logout") . "?please", array("exit"));
		}
    	
    	$request = $this->getRequest();
    	
    	$registry = Zend_Registry::getInstance();
        $config = $registry->get('config');
        
        $People = ML_People::getInstance();
        $Recover = ML_Recover::getInstance();
        
        $form = $Recover->_getRecoverForm();
        
        if($request->isPost() && $form->isValid($request->getPost()))
        {
        	$find = $form->getValues();
        	
        	$securitycode = sha1(md5(mt_rand(0, 1000).time().$find.microtime()).deg2rad(mt_rand(0,360)));
        	$getUser = $registry->accountRecover; //AccountRecover.php validator who tells
        	
        	$Recover->getAdapter()->query('INSERT INTO `recover` (`uid`, `securitycode`) VALUES (?, ?) ON DUPLICATE KEY UPDATE uid=VALUES(uid), securitycode=VALUES(securitycode), timestamp=CURRENT_TIMESTAMP', array($getUser['id'], $securitycode));
        	
        	$this->view->securitycode = $securitycode;
        	$this->view->recoverUser = $getUser;
        	
        	$this->view->recovering = true;
        	
	        $mail = new Zend_Mail();
			$mail->setBodyText($this->view->render("password/emailRecover.phtml"))
				->setFrom($config->robotEmail->addr, $config->robotEmail->name)
				->addTo($getUser['email'], $getUser['name'])
				->setSubject('Recover your '.$config->applicationname.' account')
				->send();
        }
    	
    	$this->view->recoverForm = $form;
    }
    
    public function passwordAction()
    {
    	$request = $this->getRequest();
    	
    	$auth = Zend_Auth::getInstance();
    	$registry = Zend_Registry::getInstance();
    	
    	$People = ML_People::getInstance();
    	$Credential = ML_Credential::getInstance();
    	$Recover = ML_Recover::getInstance();
    	
    	$params = $request->getParams();
    	
    	$this->view->request = $request;
    	
    	if($auth->hasIdentity())
    	{
    	    if(!isset($params['confirm_uid']) && !isset($params['security_code']))
    	    {
        	    $form = $this->_getNewPasswordForm();
        		$uid = $auth->getIdentity();
    	    	$registry->set("changeUserProperPassword", true);
{'fraction_non_alphanumeric': 0.16800804828973842, 'fraction_numerical': 0.0034492670307559644, 'mean_word_length': 2.537874936451449, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 115, 'https://': 2, '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': '1451666', 'n_tokens_mistral': 2167, 'n_tokens_neox': 2080, 'n_words': 299}