<?php

function RpcCallBack(){}

class CActionBase
{
	var $db;
	
	function CActionBase()
	{
		$this->db = new CDB();
	}
	
	function doAction()
	{
		return "";
	}	
	
	function HtmlEncode($str)
	{
		$str = str_replace("&", "&amp;", $str);
		$str = str_replace("\"", "&quot;", $str); 
		$str = str_replace("'", "&#039;", $str); 
		$str = str_replace("<", "&lt;", $str); 
		$str = str_replace(">", "&gt;", $str);
		return $str;
	}
	
	//发送通知消息
	function SendNotice($address, $msg, $issue_id)
	{
		global $Config;
		$Mail = new PHPMailer();
		switch(strtoupper($Config["Mail_SendMethod"]))
		{
		     case "SMTP":
		         $Mail->isSMTP();
		         $Mail->Host     = $Config["Mail_Host"];
		         $Mail->SMTPAuth = $Config["Mail_SMTPAuth"];
		         $Mail->Username = $Config["Mail_Username"];
		         $Mail->Password = $Config["Mail_Password"];
		         break;
		     case "MAIL":
		         $Mail->isMail();
		         break;
		     case "SENDMAIL":
		         $Mail->isSendmail();
		         break;
		     case "QMAIL":
		         $Mail->isQmail();
		         break;
		}
		
		 // Define From Address.
		$Mail->From    = $Config["Mail_FromAddress"];
		$Mail->FromName = $Config["Mail_FromName"];
		$Mail->addAddress($address);  
		// Add Subject.
		$Mail->Subject  =  $msg;
			    
		 // Set Body.
		$Mail->IsHTML(true);
		$Mail->CharSet = $Config["Charset"];
		$Mail->Body    = $msg."<br>详细情况请查看:<br>http://".$Config["kis_host"]."/kis/index.php?job=issue_info&issue_id=".$issue_id;	    
		$Mail->Send();
	
		/*
		$rpc_params = array();
		$rpc_params[0] = $address;
		$rpc_params[1] = $msg;
		$rpc_params[2] = "http://192.168.1.45/kis/index.php?job=issue_info";
		$rpc_params[3] = "issue_id=".$issue_id;
		$rpc = new CPhpRpc();
		$rpc->CallRpc("SendKisInfo", $rpc_params);
		*/
	}
};
?>
