<?php
  //引入模块公共方法文件
  require("foundation/arecent_affair.php");
  require("foundation/aanti_refresh.php");
  require("foundation/aintegral.php");
  require("foundation/adata_count.php");

	//引入语言包
	$b_langpackage=new bloglp;

	//变量取得
  $ulog_title=short_check(get_argp("blog_title"));
  $ulog_sort=intval(short_check(get_argp("blog_sort_list")));
  $ulog_txt=big_check(get_argp("blog_content"));
	$user_id=get_sess_userid();
	$user_name=get_sess_username();
	$uico_url=get_sess_userico();//用户头像
	$blog_sort_name=short_check(get_argp('blog_sort_name'));
	$blog_limit=intval(short_check(get_argp('blog_limit')));
	//防止重复提交
	antiRePost($ulog_title);

	//数据表定义区
	$t_blog=$tablePreStr."blog";

	$dbo = new dbex;
	//读写分离定义函数
	dbtarget('w',$dbServs);
	increase_integral($dbo,$int_blog,$user_id);
	
	$sql="insert into $t_blog (user_id,log_title,log_sort,log_content,add_time,log_sort_name,user_name,blog_limit,user_ico)"
	                     ."value($user_id,'$ulog_title',$ulog_sort,'$ulog_txt',NOW(),'$blog_sort_name','$user_name',$blog_limit,'$uico_url')";

	if($dbo->exeUpdate($sql)){
    if($blog_limit==0){
	    $ublog_id=mysql_insert_id();
	    set_ublog_log($dbo,$user_id,$user_name,$uico_url,$ublog_affair_log,$ulog_title,$ulog_txt,$ublog_id);	    
    }
	  //缓存功能区
	  require($webRoot.$baseLibsPath."action/blog_list_update.action.cache.php");    
    update_count($dbo,$user_id,"blog_num",1);
    action_return(1,'','');
	}else{
		  action_return(0,$b_langpackage->b_add_fal,'-1');
	}
	
?>