<?php 
class CCommentIssue extends CActionBase
{
	function doAction()
	{	
		$ret = 0;
		$job = $_POST["job"];
		GetCookie();
		
		switch($job)
		{
			case "add":
				$ret = $this->Add();
			break;
			case "mod":
				$ret = $this->Mod();
			break;
			case "del":
				$ret = $this->Del();
			break;
		}
		
		return $ret;
	}
	
	function Add()
	{
		global $UserInfo;	
		
		$issue_id = $_POST["issue_id"];
		$issue_comment = str_replace("'", "''", $_POST["issue_comment"]);  
		$comment_id = $this->db->GetMaxField('tb_issue_comment', 'comment_id')+1;
		
		$sql = "insert into tb_issue_comment (comment_id, issue_id, issue_comment, user_id, comment_time) values (";
		$sql = $sql . $comment_id.",";
		$sql = $sql . $issue_id.",";
		$sql = $sql . "'".$issue_comment."',";
		$sql = $sql . $UserInfo["UID"].",";
		$sql = $sql ."now())";
		
		$this->db->ExeSql($sql);
	}
};
?>
