<?php
/*
+--------------------------------------------------------------------------
|   TanyaCMS - Question and Answer Sofware
|   -----------------------------------------------------------------------
|   by fbschool dev team
|   (c) 2011 - 2012 FBSCHOOL
|   http://www.fbschool.com/tanyacms
|   -----------------------------------------------------------------------
|   This is NOT a freeware, use is subject to license terms
|   Support: 13455n@gmail.com
+--------------------------------------------------------------------------
*/


if (!defined('IN_TANYACMS'))
{
	die;
}

class edm extends ASK_CONTROLLER
{

	public function get_access_rule()
	{
		$rule_action['rule_type'] = 'white'; //Blacklist, blacklist check  'white' white list, outside the whitelist check
		$rule_action['actions'] = array();
		
		return $rule_action;
	}
	
	public function setup()
	{
		HTTP::no_cache_header();
	}

	public function mail_action()
	{
		if ($task = $this->model('edm')->get_task_info($_GET['id']))
		{
			echo str_replace('[EMAIL]', 'email@address.com', $task['message']);
		}
		else
		{
			H::redirect_msg('The content you are visiting does not exist');
		}
	}
	
	public function ping_action()
	{
		$param = explode('|', $_GET['id']);
		
		if (md5(base64_decode($param[0]) . GET_SECUKEY) == $param[1] AND $param[2])
		{
			$this->model('edm')->set_task_view($param[2], base64_decode($param[0]));
			
			echo 'Success';
		}
	}
}