<commit_before><?php

require_once 'Swat/SwatUI.php';
require_once 'Swat/SwatString.php';
require_once 'Site/SiteMultipartMailMessage.php';
require_once 'Site/pages/SiteEditPage.php';

/**
 *
 * @package   Site
 * @copyright 2006-2009 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SiteContactPage extends SiteEditPage
{
	// {{{ protected function getUiXml()

	protected function getUiXml()
	{
		return 'Site/pages/contact.xml';
	}

	// }}}
	// {{{ protected function getSubjects()

	protected function getSubjects()
	{
		$subjects = array(
			'general'  => Site::_('General Question'),
			'website'  => Site::_('Website'),
			'privacy'  => Site::_('Privacy'),
		);

		return $subjects;
	}

	// }}}

	// process phase
	// {{{ protected function save()

	protected function save(SwatForm $form)
	{
		$this->sendEmail();
	}

	// }}}
	// {{{ protected function relocate()

	protected function relocate(SwatForm $form)
	{
		if (count($this->app->messages) === 0) {
			$this->app->relocate($this->source.'/thankyou');
		}
	}

	// }}}
	// {{{ protected function sendEmail()

	protected function sendEmail()
	{
		$message = $this->getMessage();

		try {
			$message->send();
		} catch (SiteMailException $e) {
			$message = new SwatMessage(
				Site::_('An error has occurred sending your message.'),
				'error');

			$message->content_type = 'text/xml';
			$message->secondary_content = sprintf(Site::_('Please try again '.
				'later, or send an email directly to '.<commit_msg>remember that lots of users won't have sessions<commit_after><?php

require_once 'Swat/SwatUI.php';
require_once 'Swat/SwatString.php';
require_once 'Site/SiteMultipartMailMessage.php';
require_once 'Site/pages/SiteEditPage.php';

/**
 *
 * @package   Site
 * @copyright 2006-2009 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SiteContactPage extends SiteEditPage
{
	// {{{ protected function getUiXml()

	protected function getUiXml()
	{
		return 'Site/pages/contact.xml';
	}

	// }}}
	// {{{ protected function getSubjects()

	protected function getSubjects()
	{
		$subjects = array(
			'general'  => Site::_('General Question'),
			'website'  => Site::_('Website'),
			'privacy'  => Site::_('Privacy'),
		);

		return $subjects;
	}

	// }}}

	// process phase
	// {{{ protected function save()

	protected function save(SwatForm $form)
	{
		$this->sendEmail();
	}

	// }}}
	// {{{ protected function relocate()

	protected function relocate(SwatForm $form)
	{
		if ($this->app->session->isActive() &&
			count($this->app->messages) === 0) {
			$this->app->relocate($this->source.'/thankyou');
		}
	}

	// }}}
	// {{{ protected function sendEmail()

	protected function sendEmail()
	{
		$message = $this->getMessage();

		try {
			$message->send();
		} catch (SiteMailException $e) {
			if (!$this->app->session->isActive())
				$this->app->session->activate();

			$message = new SwatMessage(
				Site::_('An error has occurred sending your message.'),
				'error');

			$message->content_type = 'text/xml';
			$message->secondary_content = sprintf(Site::_('Please try again '.
				'later, or send an email directly to '.
{'fraction_non_alphanumeric': 0.17726276229251486, 'fraction_numerical': 0.006890072032571249, 'mean_word_length': 3.703976435935199, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '5299449', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1057, 'n_words': 223}