HttpServletResponse response) throws Exception {
ReplyForm reply = (ReplyForm) form;
//��֤�ͻ��˰�ȫʶ����
validateClientId(request, reply);
ActionMessages msgs = new ActionMessages();
PhotoReplyBean rbean = new PhotoReplyBean();
do{
if (StringUtils.isEmpty(reply.getContent())){
msgs.add("reply", new ActionMessage("error.empty_not_allowed"));
break;
}
if(reply.getContent().getBytes().length >= 3000){
msgs.add("reply", new ActionMessage("error.reply_too_long"));
break;
}
SiteBean site = super.getSiteByID(reply.getSid());
if (site == null) {
msgs.add("reply", new ActionMessage("error.site_not_available"));
break;
}
UserBean loginUser = super.getLoginUser(request, response);
//��������
if(loginUser!=null && isUserInBlackList(site, loginUser)){
msgs.add("photo", new ActionMessage("error.user_in_blacklist"));
break;
}
PhotoOutlineBean photo = PhotoDAO.getPhotoOutlineByID(reply.getParentId());
if (photo == null || photo.getSite().getId() != reply.getSid()) {
msgs.add("reply", new ActionMessage("error.param"));
break;
}
if(photo.getLock()==1) {
msgs.add("reply", new ActionMessage("error.photo.locked"));
break;
}
// ��������������
rbean.setUser(loginUser);
rbean.setAuthor(super.autoFiltrate(site,reply.getAuthor()));
if (StringUtils.isNotEmpty(reply.getAuthorURL()))
rbean.setAuthorURL(reply.getAuthorURL());
if (StringUtils.isNotEmpty(reply.getAuthorEmail()))
rbean.setAuthorEmail(reply.getAuthorEmail());
rbean.setClient(new ClientInfo(request, reply
.getClientType()));
String content = StringUtils.abbreviate(super.autoFiltrate(null,
reply.getContent()), MAX_REPLY_LENGTH);
rbean.setContent(super.filterScriptAndStyle(content));
rbean.setPhoto(photo);
rbean.setReplyTime(new Date());
rbean.setSite(site);
rbean.setStatus(DiaryReplyBean.STATUS_NORMAL);
rbean.setOwnerOnly(reply.getOwnerOnly());
PhotoDAO.createPhotoReply(rbean);
break;
}while(true);
if (!msgs.isEmpty()) {
saveMessages(request, msgs);