<commit_before><?php
/**
 * @version     2.0
 * @package     com_improvemycity
 * @copyright   Copyright (C) 2011 - 2012 URENIO Research Unit. All rights reserved.
 * @license     GNU Affero General Public License version 3 or later; see LICENSE.txt
 * @author      URENIO Research Unit
 */

// No direct access
defined('_JEXEC') or die;

require_once JPATH_COMPONENT_ADMINISTRATOR.'/models/issue.php';

/**
 * Model
 */
class ImprovemycityModelAddissue extends ImprovemycityModelIssue
{
	protected $mailNewIssueUser;
	protected $mailNewIssueAdmins;
	

	/**
	 * Get the return URL.
	 *
	 * @return	string	The return URL.
	 * @since	1.6
	 */
	public function getReturnPage()
	{

		//return base64_encode(JRoute::_('index.php?option=com_improvemycity&view=issues'));
		//return base64_encode(JRoute::_('index.php?option=com_improvemycity&view=issues&Itemid='.JRequest::getint( 'Itemid' )));
		return base64_encode(ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issues'));
	}
	
	
	protected function populateState()
	{
		$app = JFactory::getApplication();
		
		// Load the parameters.
		$params	= $app->getParams();
		$this->setState('params', $params);	
		
		$this->mailNewIssueAdmins = $params->get('mailnewissueadmins');
		$this->mailNewIssueUser = $params->get('mailnewissueuser');
		
		$return = JRequest::getVar('return', null, 'default', 'base64');

		if (!JUri::isInternal(base64_decode($return))) {
			$return = null;
		}

		$this->setState('return_page', base64_decode($return));		
	}


	/**
	 * Method to get the script that have to be included on the form
	 *
	 * @return string	Script files
	 */
	public function getScript() 
	{
		return 'components/com_improvemycity/models/forms/issue.js';
	}	
	 
    private function notifyByEmail($id, $data)
	{

		
		//get the link to the newly created issue
		$issueLink = 'http://'. $_SERVER['HTTP_HOST'] . ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id='.$id);

		//$issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&layout=edit&id='.$table->id;
		
		/*fixing "You are not permitted to use that link to directly access that page"*/
		$issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&task=issue.edit&id='.$id; 
		
		
		$user = JFactory::getUser();
		$app = JFactory::getApplication();
		$mailfrom	= $app->getCfg('mailfrom');
		$fromname	= $app->getCfg('fromname');
		$sitename	= $app->getCfg('sitename');		


		/* (A) ****--- Send notification mail to appropriate admins (as defined on category note field) */<commit_msg>Fix problem with notification mail on new issue<commit_after><?php
/**
 * @version     2.0
 * @package     com_improvemycity
 * @copyright   Copyright (C) 2011 - 2012 URENIO Research Unit. All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      URENIO Research Unit
 */

// No direct access
defined('_JEXEC') or die;

require_once JPATH_COMPONENT_ADMINISTRATOR.'/models/issue.php';

/**
 * Model
 */
class ImprovemycityModelAddissue extends ImprovemycityModelIssue
{
	protected $mailNewIssueUser;
	protected $mailNewIssueAdmins;
	

	/**
	 * Get the return URL.
	 *
	 * @return	string	The return URL.
	 * @since	1.6
	 */
	public function getReturnPage()
	{

		//return base64_encode(JRoute::_('index.php?option=com_improvemycity&view=issues'));
		//return base64_encode(JRoute::_('index.php?option=com_improvemycity&view=issues&Itemid='.JRequest::getint( 'Itemid' )));
		return base64_encode(ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issues'));
	}
	
	
	protected function populateState()
	{
		$app = JFactory::getApplication();
		
		// Load the parameters.
		$params	= $app->getParams();
		$this->setState('params', $params);	
		
		$this->mailNewIssueAdmins = $params->get('mailnewissueadmins');
		$this->mailNewIssueUser = $params->get('mailnewissueuser');
		
		$return = JRequest::getVar('return', null, 'default', 'base64');

		if (!JUri::isInternal(base64_decode($return))) {
			$return = null;
		}

		$this->setState('return_page', base64_decode($return));		
	}


	/**
	 * Method to get the script that have to be included on the form
	 *
	 * @return string	Script files
	 */
	public function getScript() 
	{
		return 'components/com_improvemycity/models/forms/issue.js';
	}	
	 
    private function notifyByEmail($id, $data)
	{
		// Load the parameters.
		$app = JFactory::getApplication();
		$par	= $app->getParams();
		$this->mailNewIssueAdmins = $par->get('mailnewissueadmins');
		$this->mailNewIssueUser = $par->get('mailnewissueuser');
		
		//get the link to the newly created issue
		$issueLink = 'http://'. $_SERVER['HTTP_HOST'] . ImprovemycityHelper::generateRouteLink('index.php?option=com_improvemycity&view=issue&issue_id='.$id);

		//$issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&layout=edit&id='.$table->id;
		
		/*fixing "You are not permitted to use that link to directly access that page"*/
		$issueAdminLink = JURI::root() . 'administrator/' . 'index.php?option=com_improvemycity&view=issue&task=issue.edit&id='.$id; 
		
		
		$user = JFactory::getUser();
		$app = JFactory::getApplication();
		$mailfrom	= $app->getCfg('mailfrom');
		$fromname	= $app->getCfg('fromname');
		$sitename	= $app->getCfg('sitename');		


		/* (A) ****--- Send notification mail to appropriate admins (as defined on category note field) */
{'fraction_non_alphanumeric': 0.15345730276223146, 'fraction_numerical': 0.009026900162484202, 'mean_word_length': 4.54, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '4859041', 'n_tokens_mistral': 2022, 'n_tokens_neox': 1783, 'n_words': 377}