<?php
	//引入语言包
	$scr_langpackage=new msglp;
	
	$m_user=$scr_langpackage->m_user;
	$text_each_friend=$scr_langpackage->m_each_fri;
	$text_agree_apply=$scr_langpackage->m_agr_app;
	$text_reject_apply=$scr_langpackage->m_rej_app;
	$text_append_friend=$scr_langpackage->m_app_fri;
	$text_system_send=$scr_langpackage->m_sys_send;
	$com_each_friend=$scr_langpackage->m_each_friend;
	$com_agree_apply=$scr_langpackage->m_agree_app;
	$com_reject_apply=$scr_langpackage->m_reject_app;
	$com_append_friend=$scr_langpackage->m_app_friend;
	$m_no_sed=$scr_langpackage->m_no_sed;
	$m_sed=$scr_langpackage->m_sed;
	$m_rd=$scr_langpackage->m_rd;
	$m_no_rd=$scr_langpackage->m_no_rd;
	$t_msg_inbox = $tablePreStr."msg_inbox";

function send_scrip($dbo,$from_username,$from_userid,$from_userico,$to_userid,$type)
{
	global $m_user;
	global $text_each_friend;
	global $text_agree_apply;
	global $text_reject_apply;
	global $text_append_friend;
	global $text_system_send;
	global $com_each_friend;
	global $com_agree_apply;
	global $com_reject_apply;
	global $com_append_friend;
	global $t_msg_inbox;
	
	if($type==0){
		$msg_title=$m_user.$from_username.$text_each_friend;
		$msg_txt=$m_user.$from_username.$com_each_friend;
		}
	if($type==1){
		$msg_title=$m_user.$from_username.$text_agree_apply;
		$msg_txt=$m_user.$from_username.$com_agree_apply;
	}
	if($type==2){
		$msg_title=$m_user.$from_username.$text_reject_apply;
		$msg_txt=$m_user.$from_username.$com_reject_apply;
	}
	if($type==3){
		$msg_title=$m_user.$from_username.$text_append_friend;
		$msg_txt=$m_user.$from_username.$com_append_friend;
	}
	
	$sql="insert into $t_msg_inbox (mess_title,mess_content,from_user,from_user_ico,user_id,add_time,from_user_id)"
	                    ."value('$msg_title','$msg_txt','$text_system_send','$from_userico',$to_userid,NOW(),$from_userid)";
	$dbo->exeUpdate($sql);
	update_count($dbo,$to_userid,"scrip_num",1);
}

function readStr($state){
	global $readStr;
	global $m_no_sed;
	global $m_sed;
	global $m_rd;
	if($state=="0"){
		$readStr=$m_no_sed; 
	}
	if($state=="1"){ 
		$readStr=$m_sed; 
	}
	if($state=="2"){ 
		$readStr=$m_rd; 
	}
}

function readed($state){
	global $readStr;
	global $m_no_rd;
	global $m_rd;
	if($state=="0"){ 
		$readStr=$m_no_rd; 
	}
	if($state=="1"){ 
		$readStr=$m_rd;  
	}
}
?>