<?php
/**
 * pages-model
 *
 * @package baseContent
 * @subpackage pages
 */
class app_pages_model extends fl_model {
	/**
	 * Kontaktformular in mail verpacken und absenden
	 *
	 * Die Daten des Kontaktfomulars werden per e-mail verschickt.
	 *
	 * @param array $data
	 * @return mixed 
	 */
	function send_contact($data) {
		$this->functions->needs('mail');
		$m = new e_mail();

		$to = 'info@2erlei.de';
		$from = 'kontaktformular@2erlei.de';
		$topic = '[2erlei] Kontaktformular';
		$template = file_get_contents( ABSPATH . 'app/modules/pages/views/contact.tpl');
		$data['time'] = date('d.m.Y \u\m H:i', mktime());

		$text = $m->parse_template($template, $data);

		$m->set_config($to, $from, $topic);
		$m->set_text($text);
		$m->compose_message();

		$send_contact = $m->send_mail();
		if (!$send_contact) $send_contact = $m->get_error();

		return $send_contact;
	}
} 
?>
