<?php
function bb_add_message_ads()
{
$username=isset(Configs::$_['user_data']['user_id'])?Configs::$_['user_data']['user_id']:'';
// useClass('EmailSystem');
// Check default post status of user group
$status='1';
$subject=addslashes(getPost('subject'));
$content=addslashes(getPost('content'));
$useID=rand(6,20);
$message_id=newID($useID);
$insertData=array(
'message_id'=>$message_id,
'subject'=>$subject,
'content'=>$content,
'allow_reply'=>'0',
'username'=>Configs::$_['user_data']['username'],
'user_id'=>Configs::$_['user_data']['user_id'],
);
if(!isset($insertData['content'][1]))
{
return 'Content not allow blank!';
}
if(!isset($insertData['subject'][1]))
{
return 'Subject not allow blank!';
}
$db=new Database();
$queryStr=arrayToInsertStr('bb_message_data',$insertData);
$db->nonquery($queryStr);
$insertData=array(
'message_id'=>$message_id,
'user_id'=>Configs::$_['user_data']['user_id'],
);
$queryStr=arrayToInsertStr('bb_message_ads_data',$insertData);
$db->nonquery($queryStr);
$queryStr=" insert into bb_message_user_data";
$queryStr.=" select '".$message_id."',username,user_id,'".Configs::$_['user_data']['user_id']."','0',NULL";
$queryStr.=" from user_mst";
$db->nonquery($queryStr);
return 'Done';
}
|