| 105 |
bool head_find; |
bool head_find; |
| 106 |
CString head_name,head_value,path,from,subject,newsgroups,organization,date,msg_id; //Head |
CString head_name,head_value,path,from,subject,newsgroups,organization,date,msg_id; //Head |
| 107 |
DateTimeConvert sub_dt; |
DateTimeConvert sub_dt; |
| 108 |
CString ptitle,nickname,dt_str,content,msg_content,sql; |
CString ptitle,username,nickname,dt_str,content,msg_content,sql; |
| 109 |
int length; |
int length; |
| 110 |
long id,aid,cid,rid; |
long id,aid,cid; |
| 111 |
|
|
| 112 |
try |
try |
| 113 |
{ |
{ |
| 197 |
if (subject.GetLength() > 80) |
if (subject.GetLength() > 80) |
| 198 |
subject = subject.Left(75) + " ……"; |
subject = subject.Left(75) + " ……"; |
| 199 |
|
|
| 200 |
//Get nickname |
//Get username |
| 201 |
nickname = "cn.bbs"; |
username = "cn.bbs."; |
| 202 |
for (int i=0;i<from.GetLength();i++) |
for (int i=0;i<from.GetLength();i++) |
| 203 |
{ |
{ |
| 204 |
if (from[i] == '.' || from[i] == '@') |
if (from[i] == '.' || from[i] == '@') |
| 209 |
if (from[j] == ' ' || from[j] == '<') |
if (from[j] == ' ' || from[j] == '<') |
| 210 |
break; |
break; |
| 211 |
} |
} |
| 212 |
nickname = from.Mid(j+1,i-j-1) + "."; |
username = from.Mid(j+1,i-j-1) + "."; |
| 213 |
|
break; |
| 214 |
|
} |
| 215 |
|
} |
| 216 |
|
if (username.GetLength() > 12) |
| 217 |
|
username = username.Left(12) + "."; |
| 218 |
|
|
| 219 |
|
//Get nickname |
| 220 |
|
nickname = "cn.bbs"; |
| 221 |
|
for (int i=0;i<from.GetLength();i++) |
| 222 |
|
{ |
| 223 |
|
if (from[i] == '(') |
| 224 |
|
{ |
| 225 |
|
int j; |
| 226 |
|
for (j=i+1;j<from.GetLength();j++) |
| 227 |
|
{ |
| 228 |
|
if (from[j] == ')') |
| 229 |
|
break; |
| 230 |
|
} |
| 231 |
|
nickname = from.Mid(i+1,j-i-1); |
| 232 |
break; |
break; |
| 233 |
} |
} |
| 234 |
} |
} |
| 235 |
if (nickname.GetLength() > 20) |
if (nickname.GetLength() > 20) |
| 236 |
nickname = nickname.Left(19) + "."; |
nickname = nickname.Left(20); |
| 237 |
|
|
| 238 |
//Reference /bbs/add_sub.php |
//Reference /bbs/add_sub.php |
| 239 |
|
|
| 242 |
this->Db.ExecuteSQL(sql); |
this->Db.ExecuteSQL(sql); |
| 243 |
cid = this->last_insert_id(); |
cid = this->last_insert_id(); |
| 244 |
|
|
| 245 |
sql.Format("insert into bbs(SID,TID,UID,nickname,title,CID,sub_dt," |
sql.Format("insert into bbs(SID,TID,UID,username,nickname,title,CID,sub_dt," |
| 246 |
"sub_ip,last_reply_dt,icon,length,transship)" |
"sub_ip,last_reply_dt,icon,length,transship)" |
| 247 |
"values(%d,%ld,%ld,'%s','%s',%ld,adddate('%s',interval '8' hour)," |
"values(%d,%ld,%ld,'%s','%s','%s',%ld,adddate('%s',interval '8' hour)," |
| 248 |
"'%s',adddate('%s',interval '8' hour),1,%d,1)", |
"'%s',adddate('%s',interval '8' hour),1,%d,1)", |
| 249 |
sid,id,this->innd_uid,addslashes(nickname),addslashes(subject), |
sid,id,this->innd_uid,addslashes(username),addslashes(nickname),addslashes(subject), |
| 250 |
cid,dt_str,this->hostaddr,dt_str,length); |
cid,dt_str,this->hostaddr,dt_str,length); |
| 251 |
this->Db.ExecuteSQL(sql); |
this->Db.ExecuteSQL(sql); |
| 252 |
aid = this->last_insert_id(); |
aid = this->last_insert_id(); |
| 265 |
{ |
{ |
| 266 |
sql.Format("update bbs set cached=0, reply_count=reply_count+1," |
sql.Format("update bbs set cached=0, reply_count=reply_count+1," |
| 267 |
"last_reply_dt=adddate('%s',interval '8' hour),last_reply_UID=%ld," |
"last_reply_dt=adddate('%s',interval '8' hour),last_reply_UID=%ld," |
| 268 |
"last_reply_nickname='%s' where aid=%ld", |
"last_reply_username='%s',last_reply_nickname='%s' where aid=%ld", |
| 269 |
dt_str,this->innd_uid,nickname,id); |
dt_str,this->innd_uid,username,nickname,id); |
| 270 |
this->Db.ExecuteSQL(sql); |
this->Db.ExecuteSQL(sql); |
| 271 |
} |
} |
| 272 |
|
|
| 273 |
//Notify the author of the artile which is replyed. |
//Notify the author of the artile which is replyed. |
| 274 |
if (id != 0) |
if (id != 0) |
| 275 |
{ |
{ |
| 276 |
sql.Format("select user_pubinfo.UID,user_pubinfo.nickname," |
sql.Format("select distinct UID from bbs where (AID=%ld or TID=%ld)" |
| 277 |
"user_pubinfo.email from bbs left join user_pubinfo on" |
" and visible and reply_note and UID<>%ld",id,id,this->innd_uid); |
|
" bbs.UID=user_pubinfo.UID where AID=%ld and reply_note", |
|
|
id); |
|
| 278 |
RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); |
RS.Open(CRecordset::snapshot,sql,CRecordset::forwardOnly | CRecordset::readOnly); |
| 279 |
|
|
| 280 |
if (!RS.IsEOF()) |
while (!RS.IsEOF()) |
| 281 |
{ |
{ |
| 282 |
RS.GetFieldValue("UID",dbVar),SQL_C_SLONG; |
//Send notication message |
| 283 |
if (dbVar.m_lVal != innd_uid) |
|
| 284 |
{ |
msg_content.Format("[hide]SYS_R_Reply_Article[/hide]" |
| 285 |
sql.Format("update user_pubinfo set exp=exp+1 where UID=%ld", |
"有人回复了您所发表的文章,快来[article %ld#%ld" |
| 286 |
dbVar.m_lVal); |
"]看看[/article]《%s》吧!\n",id,aid,addslashes(subject)); |
| 287 |
this->Db.ExecuteSQL(sql); |
|
| 288 |
|
RS.GetFieldValue("UID",dbVar,SQL_C_SLONG); |
| 289 |
RS.GetFieldValue("email",dbVar,SQL_C_CHAR); |
|
| 290 |
sql.Format("insert into bbs_recommend(UID,TID,type,dt,email,ip)" |
sql.Format("insert into bbs_msg(fromUID,toUID,content,send_dt,send_ip)" |
| 291 |
" values(%ld,%ld,'D',now(),'%s','%s')", |
" values(%ld,%ld,'%s',now(),'%s')", |
| 292 |
this->innd_uid,aid,dbVar.m_pstring,this->hostaddr); |
this->innd_uid,dbVar.m_lVal,addslashes(msg_content),this->hostaddr); |
| 293 |
this->Db.ExecuteSQL(sql); |
this->Db.ExecuteSQL(sql); |
| 294 |
rid = this->last_insert_id(); |
} |
|
|
|
|
//Send notication message |
|
|
|
|
|
msg_content.Format("[hide]SYS_R_Reply_Article[/hide]" |
|
|
"有人回复了您所发表的文章,快来[url recommend_view.php?id=%ld" |
|
|
"]看看[/url]《%s》吧!\n",rid,addslashes(subject)); |
|
|
|
|
|
RS.GetFieldValue("UID",dbVar,SQL_C_SLONG); |
|
|
sql.Format("insert into bbs_msg(fromUID,toUID,content,send_dt,send_ip)" |
|
|
" values(%ld,%ld,'%s',now(),'%s')", |
|
|
this->innd_uid,dbVar.m_lVal,addslashes(msg_content),this->hostaddr); |
|
|
this->Db.ExecuteSQL(sql); |
|
|
} |
|
|
} |
|
| 295 |
RS.Close(); |
RS.Close(); |
| 296 |
} |
} |
| 297 |
|
|