PageRenderTime 49ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/projects/mvnforum-1.2.2-ga/mvnforum/src/com/mvnforum/admin/MemberWebHandler.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 847 lines | 630 code | 130 blank | 87 comment | 105 complexity | 409dc1306e3ee4389e0c2b838350f368 MD5 | raw file
  1. /*
  2. * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/admin/MemberWebHandler.java,v 1.165.2.2 2008/11/18 08:27:37 nguyendnc Exp $
  3. * $Author: nguyendnc $
  4. * $Revision: 1.165.2.2 $
  5. * $Date: 2008/11/18 08:27:37 $
  6. *
  7. * ====================================================================
  8. *
  9. * Copyright (C) 2002-2007 by MyVietnam.net
  10. *
  11. * All copyright notices regarding mvnForum MUST remain
  12. * intact in the scripts and in the outputted HTML.
  13. * The "powered by" text/logo with a link back to
  14. * http://www.mvnForum.com and http://www.MyVietnam.net in
  15. * the footer of the pages MUST remain visible when the pages
  16. * are viewed on the internet or intranet.
  17. *
  18. * This program is free software; you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License as published by
  20. * the Free Software Foundation; either version 2 of the License, or
  21. * any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program; if not, write to the Free Software
  30. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  31. *
  32. * Support can be obtained from support forums at:
  33. * http://www.mvnForum.com/mvnforum/index
  34. *
  35. * Correspondence and Marketing Questions can be sent to:
  36. * info at MyVietnam net
  37. *
  38. * @author: Minh Nguyen
  39. * @author: Mai Nguyen
  40. * @author: Igor Manic
  41. */
  42. package com.mvnforum.admin;
  43. import java.io.File;
  44. import java.io.IOException;
  45. import java.sql.Date;
  46. import java.sql.Timestamp;
  47. import java.util.*;
  48. import net.myvietnam.mvncore.MVNCoreResourceBundle;
  49. import net.myvietnam.mvncore.exception.*;
  50. import net.myvietnam.mvncore.filter.DisableHtmlTagFilter;
  51. import net.myvietnam.mvncore.interceptor.InterceptorService;
  52. import net.myvietnam.mvncore.security.Encoder;
  53. import net.myvietnam.mvncore.security.SecurityUtil;
  54. import net.myvietnam.mvncore.service.EventLogService;
  55. import net.myvietnam.mvncore.service.MvnCoreServiceFactory;
  56. import net.myvietnam.mvncore.util.*;
  57. import net.myvietnam.mvncore.web.GenericRequest;
  58. import net.myvietnam.mvncore.web.GenericResponse;
  59. import org.apache.commons.logging.Log;
  60. import org.apache.commons.logging.LogFactory;
  61. import com.mvnforum.*;
  62. import com.mvnforum.auth.*;
  63. import com.mvnforum.categorytree.*;
  64. import com.mvnforum.common.*;
  65. import com.mvnforum.db.*;
  66. import com.mvnforum.search.member.MemberIndexer;
  67. import com.mvnforum.search.member.MemberSearchQuery;
  68. import com.mvnforum.service.*;
  69. public class MemberWebHandler {
  70. private static final Log log = LogFactory.getLog(MemberWebHandler.class);
  71. private OnlineUserManager onlineUserManager = OnlineUserManager.getInstance();
  72. private static CategoryService categoryService = MvnForumServiceFactory.getMvnForumService().getCategoryService();
  73. private static CategoryBuilderService categoryBuilderService = MvnForumServiceFactory.getMvnForumService().getCategoryBuilderService();
  74. private static EventLogService eventLogService = MvnCoreServiceFactory.getMvnCoreService().getEventLogService();
  75. public MemberWebHandler() {
  76. }
  77. public void prepareAdd(GenericRequest request) throws AuthenticationException, DatabaseException {
  78. if (MVNForumConfig.getEnableExternalUserDatabase()) {
  79. Locale locale = I18nUtil.getLocaleInRequest(request);
  80. String localizedMessage = MVNForumResourceBundle.getString(locale, "java.lang.IllegalStateException.create_user_is_disabled");
  81. throw new IllegalStateException(localizedMessage);
  82. //throw new IllegalStateException("Cannot create user if we enable external user database.");
  83. }
  84. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  85. MVNForumPermission permission = onlineUser.getPermission();
  86. permission.ensureCanAdminSystem();
  87. }
  88. public void processAdd(GenericRequest request)
  89. throws BadInputException, ObjectNotFoundException, CreateException, DatabaseException,
  90. DuplicateKeyException, ForeignKeyNotFoundException, AuthenticationException, InterceptorException {
  91. Locale locale = I18nUtil.getLocaleInRequest(request);
  92. if (MVNForumConfig.getEnableExternalUserDatabase()) {
  93. String localizedMessage = MVNForumResourceBundle.getString(locale, "java.lang.IllegalStateException.create_user_is_disabled");
  94. throw new IllegalStateException(localizedMessage);
  95. //throw new IllegalStateException("Cannot create user if we enable external user database.");
  96. }
  97. SecurityUtil.checkHttpPostMethod(request);
  98. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  99. MVNForumPermission permission = onlineUser.getPermission();
  100. permission.ensureCanAdminSystem();
  101. Timestamp now = DateUtil.getCurrentGMTTimestamp();
  102. String memberName = GenericParamUtil.getParameterSafe(request, "MemberName", true); // check good name
  103. /** @todo move to a name filter */
  104. if ( memberName.equalsIgnoreCase(MVNForumConfig.getDefaultGuestName()) ||
  105. memberName.equalsIgnoreCase("Guest") ||
  106. memberName.equalsIgnoreCase("Administrator") ||
  107. memberName.equalsIgnoreCase("Moderator") ) {
  108. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.cannot_register_with_reserved_name", new Object[] {memberName});
  109. throw new BadInputException(localizedMessage);
  110. //throw new BadInputException("Cannot register member with a reserved name : " + memberName);
  111. }
  112. StringUtil.checkGoodName(memberName);
  113. InterceptorService.getInstance().validateLoginID(memberName);
  114. if (memberName.length() > MVNForumGlobal.MAX_MEMBER_LOGIN_LENGTH) {
  115. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.member_name_too_long");
  116. throw new BadInputException(localizedMessage);
  117. //throw new BadInputException("MemberName cannot be longer than 30 characters.");
  118. }
  119. String memberPassword1 = GenericParamUtil.getParameterPassword(request, "MemberMatkhau", 3, 0);
  120. String memberPassword2 = GenericParamUtil.getParameterPassword(request, "MemberMatkhauConfirm", 3, 0);
  121. InterceptorService.getInstance().validatePassword(memberPassword1);
  122. if (!memberPassword1.equals(memberPassword2)) {
  123. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.confirmed_password_is_not_match");
  124. throw new BadInputException(localizedMessage);
  125. //throw new BadInputException("Password and confirmed password are not the same, please try again.");
  126. }
  127. String memberPassword = Encoder.getMD5_Base64(memberPassword1);
  128. String memberEmail = GenericParamUtil.getParameterEmail(request, "MemberEmail");
  129. String memberEmailConfirm = GenericParamUtil.getParameterEmail(request, "MemberEmailConfirm");
  130. if (!memberEmail.equals(memberEmailConfirm)) {
  131. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.confirmed_email_is_not_match");
  132. throw new BadInputException(localizedMessage);
  133. //throw new BadInputException("Email and confirmed email are not the same, please try again.");
  134. }
  135. if (memberEmail.length() > MVNForumGlobal.MAX_MEMBER_EMAIL_LENGTH) {
  136. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.member_email_too_long");
  137. throw new BadInputException(localizedMessage);
  138. //throw new BadInputException("MemberEmail cannot be longer than 60 characters.");
  139. }
  140. String memberFirstEmail = memberEmail;
  141. InterceptorService.getInstance().validateMail(memberFirstEmail);
  142. int memberEmailVisible = MemberBean.MEMBER_EMAIL_INVISIBLE;
  143. int memberNameVisible = MemberBean.MEMBER_NAME_VISIBLE;
  144. String memberFirstIP = request.getRemoteAddr();
  145. String memberLastIP = memberFirstIP;
  146. int memberOption = 0;//@todo review and support it later
  147. int memberStatus = MemberBean.MEMBER_STATUS_ENABLE;//MemberBean.MEMBER_STATUS_PENDING;// @todo review and support it later, ex: should it be active or not?
  148. String memberActivateCode = "";// @todo review and support it later
  149. int memberMessageOption = 0;// @todo review and support it later
  150. int memberPostsPerPage = 10; //default for all preregistered users
  151. Date memberBirthday = new java.sql.Date(now.getTime());
  152. Timestamp memberCreationDate= now;
  153. Timestamp memberModifiedDate= now;
  154. Timestamp memberExpireDate = memberCreationDate;// equal Creation Date mean no expiration
  155. Timestamp memberPasswordExpireDate = memberCreationDate;// equal Creation Date mean no password expiration
  156. DAOFactory.getMemberDAO().create(memberName, memberPassword, memberFirstEmail,
  157. memberEmail, memberEmailVisible, memberNameVisible,
  158. memberFirstIP, memberLastIP, 0/*memberViewCount*/,
  159. 0/*memberPostCount*/, memberCreationDate, memberModifiedDate, memberExpireDate, memberPasswordExpireDate,
  160. now/*memberLastLogon*/, memberOption, memberStatus,
  161. memberActivateCode, ""/*memberTempPassword*/, 0/*memberMessageCount*/,
  162. memberMessageOption, memberPostsPerPage, 0/*memberWarnCount*/,
  163. 0/*memberVoteCount*/, 0/*memberVoteTotalStars*/, 0/*memberRewardPoints*/,
  164. ""/*memberTitle*/, 0/*memberTimeZone*/, ""/*memberSignature*/,
  165. ""/*memberAvatar*/, ""/*memberSkin*/, ""/*memberLanguage*/,
  166. " "/*memberFirstname*/, " "/*memberLastname*/, 1/*memberGender*/,
  167. memberBirthday, ""/*memberAddress*/, ""/*memberCity*/,
  168. ""/*memberState*/, ""/*memberCountry*/, ""/*memberPhone*/,
  169. ""/*memberMobile*/, ""/*memberFax*/, ""/*memberCareer*/,
  170. ""/*memberHomepage*/, ""/*memberYahoo*/, ""/*memberAol*/,
  171. ""/*memberIcq*/, ""/*memberMsn*/, ""/*memberCoolLink1*/,
  172. ""/*memberCoolLink2*/);
  173. // Now, create 4 default folders for each member
  174. int memberID = MemberCache.getInstance().getMemberIDFromMemberName(memberName);
  175. int folderStatus = 0;
  176. int folderOption = 0;
  177. int folderType = 0;
  178. DAOFactory.getMessageFolderDAO().create(MVNForumConstant.MESSAGE_FOLDER_INBOX, memberID, 0/*order*/, folderStatus, folderOption, folderType, now, now);
  179. DAOFactory.getMessageFolderDAO().create(MVNForumConstant.MESSAGE_FOLDER_DRAFT, memberID, 1/*order*/, folderStatus, folderOption, folderType, now, now);
  180. DAOFactory.getMessageFolderDAO().create(MVNForumConstant.MESSAGE_FOLDER_SENT, memberID, 2/*order*/, folderStatus, folderOption, folderType, now, now);
  181. DAOFactory.getMessageFolderDAO().create(MVNForumConstant.MESSAGE_FOLDER_TRASH, memberID, 3/*order*/, folderStatus, folderOption, folderType, now, now);
  182. // Add member to the lucene index
  183. MemberBean memberBean = null;
  184. try {
  185. memberBean = DAOFactory.getMemberDAO().getMember(memberID);
  186. } catch(ObjectNotFoundException ex) {
  187. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  188. throw new ObjectNotFoundException(localizedMessage);
  189. }
  190. MemberIndexer.scheduleAddMemberTask(memberBean);
  191. // now, if require activation, then we will send mail
  192. // Note that because after this page succeed,
  193. // we redirect to usermanagement so not use mvnforum.mail.failed now
  194. if (MVNForumConfig.getRequireActivation()) {
  195. String serverName = ParamUtil.getServerPath();//ParamUtil.getServer2(request);
  196. try {
  197. SendMailUtil.sendActivationCodeEmail(memberID, serverName);
  198. } catch (Exception ex) {
  199. log.error("Cannot send mail after registration!", ex);
  200. request.setAttribute("mvnforum.mail.failed", "Cannot send activation email after registration!");
  201. //@todo: save the error message to displayed later
  202. }
  203. }
  204. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.AddMemberProcess", new Object[]{memberName});
  205. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "add member", actionDesc, EventLogService.MEDIUM);
  206. }
  207. public void processUpdateMemberStatus(GenericRequest request)
  208. throws BadInputException, ObjectNotFoundException, DatabaseException, AuthenticationException {
  209. SecurityUtil.checkHttpReferer(request);
  210. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  211. MVNForumPermission permission = onlineUser.getPermission();
  212. permission.ensureCanModerateUser();
  213. // primary key column(s)
  214. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  215. // column(s) to update
  216. int memberStatus = GenericParamUtil.getParameterInt(request, "status");
  217. Locale locale = I18nUtil.getLocaleInRequest(request);
  218. // now check if status is in the valid range
  219. if ( (memberStatus != MemberBean.MEMBER_STATUS_ENABLE) && (memberStatus != MemberBean.MEMBER_STATUS_DISABLE) ) {
  220. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.cannot_update_member_status.unknown_status", new Object[] { new Integer(memberStatus)});
  221. throw new BadInputException(localizedMessage);
  222. //throw new BadInputException("Cannot update member's status to an unknown status = " + memberStatus);
  223. }
  224. // This code make sure Admin always has Enable status
  225. if (memberID == MVNForumConstant.MEMBER_ID_OF_ADMIN) {
  226. memberStatus = MemberBean.MEMBER_STATUS_ENABLE;
  227. }
  228. //IMPORTANT: Guest (id=MEMBER_ID_OF_GUEST) can be disabled by administrator.
  229. try {
  230. DAOFactory.getMemberDAO().updateStatus(memberID, memberStatus);
  231. } catch (ObjectNotFoundException e) {
  232. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  233. throw new ObjectNotFoundException(localizedMessage);
  234. }
  235. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.UpdateMemberStatus", new Object[]{new Integer(memberID), new Integer(memberStatus)});
  236. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "update member status", actionDesc, EventLogService.MEDIUM);
  237. }
  238. public void prepareEdit(GenericRequest request)
  239. throws BadInputException, ObjectNotFoundException, DatabaseException, AuthenticationException {
  240. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  241. MVNForumPermission permission = onlineUser.getPermission();
  242. permission.ensureCanModerateUser();
  243. Locale locale = I18nUtil.getLocaleInRequest(request);
  244. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  245. MemberBean memberBean = null;
  246. try {
  247. memberBean = DAOFactory.getMemberDAO().getMember(memberID);
  248. } catch (ObjectNotFoundException e) {
  249. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  250. throw new ObjectNotFoundException(localizedMessage);
  251. }
  252. request.setAttribute("MemberBean", memberBean);
  253. }
  254. public void processEdit(GenericRequest request, GenericResponse response)
  255. throws BadInputException, ObjectNotFoundException, DatabaseException, AuthenticationException {
  256. SecurityUtil.checkHttpPostMethod(request);
  257. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  258. MVNForumPermission permission = onlineUser.getPermission();
  259. permission.ensureCanModerateUser();
  260. // now check the password
  261. MyUtil.ensureCorrectCurrentPassword(request);
  262. MyUtil.saveVNTyperMode(request, response);
  263. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  264. MemberBean memberBean = DAOFactory.getMemberDAO().getMember(memberID);
  265. MemberMapping mapping = MemberMapping.getInstance();
  266. boolean internalUserDatabase = !MVNForumConfig.getEnableExternalUserDatabase();
  267. Timestamp now = DateUtil.getCurrentGMTTimestamp();
  268. // column(s) to update
  269. int memberEmailVisible = memberBean.getMemberEmailVisible();
  270. int memberNameVisible = memberBean.getMemberNameVisible();
  271. int memberOption = 0;//GenericParamUtil.getParameterInt(request, "MemberOption");
  272. int memberStatus = GenericParamUtil.getParameterInt(request, "MemberStatus");
  273. int memberMessageOption = 0;//GenericParamUtil.getParameterInt(request, "MemberMessageOption");
  274. int memberPostsPerPage = memberBean.getMemberPostsPerPage();
  275. if (memberPostsPerPage < 5) {
  276. memberPostsPerPage = 5;
  277. }
  278. double memberTimeZone = memberBean.getMemberTimeZone();
  279. String memberSkin = memberBean.getMemberSkin();
  280. String memberLanguage = memberBean.getMemberLanguage();
  281. String memberFirstname = memberBean.getMemberFirstname();
  282. String memberLastname = memberBean.getMemberLastname();
  283. int memberGender = memberBean.getMemberGender();
  284. Date memberBirthday = memberBean.getMemberBirthday();
  285. String memberAddress = memberBean.getMemberAddress();
  286. String memberCity = memberBean.getMemberCity();
  287. String memberState = memberBean.getMemberState();
  288. String memberCountry = memberBean.getMemberCountry();
  289. String memberPhone = memberBean.getMemberPhone();
  290. String memberMobile = memberBean.getMemberMobile();
  291. String memberFax = memberBean.getMemberFax();
  292. String memberCareer = memberBean.getMemberCareer();
  293. String memberHomepage = memberBean.getMemberHomepage();
  294. String memberYahoo = memberBean.getMemberYahoo();
  295. String memberAol = memberBean.getMemberAol();
  296. String memberIcq = memberBean.getMemberIcq();
  297. String memberMsn = memberBean.getMemberMsn();
  298. String memberCoolLink1 = memberBean.getMemberCoolLink1();
  299. String memberCoolLink2 = memberBean.getMemberCoolLink2();
  300. // column(s) to update
  301. if (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberEmailVisible())) {
  302. memberEmailVisible = GenericParamUtil.getParameterBoolean(request, "MemberEmailVisible")? MemberBean.MEMBER_EMAIL_VISIBLE : MemberBean.MEMBER_EMAIL_INVISIBLE;
  303. }
  304. if (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberNameVisible())) {
  305. memberNameVisible = GenericParamUtil.getParameterBoolean(request, "MemberNameVisible") ? MemberBean.MEMBER_NAME_VISIBLE : MemberBean.MEMBER_NAME_INVISIBLE;
  306. }
  307. if (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberPostsPerPage())) {
  308. memberPostsPerPage = GenericParamUtil.getParameterInt(request, "MemberPostsPerPage");
  309. }
  310. if (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberTimeZone())) {
  311. memberTimeZone = GenericParamUtil.getParameterTimeZone(request, "MemberTimeZone");
  312. }
  313. if (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberSkin())) {
  314. memberSkin = GenericParamUtil.getParameterFilter(request, "MemberSkin", false);
  315. }
  316. if (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberLanguage())) {
  317. memberLanguage = GenericParamUtil.getParameterFilter(request, "MemberLanguage", false);
  318. }
  319. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberFirstname())) &&
  320. MVNForumConfig.getEnableShowFirstName() ) {
  321. memberFirstname = GenericParamUtil.getParameterFilter(request, "MemberFirstname", MVNForumConfig.isRequireRegisterFirstname());
  322. }
  323. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberLastname())) &&
  324. MVNForumConfig.getEnableShowLastName() ) {
  325. memberLastname = GenericParamUtil.getParameterFilter(request, "MemberLastname", MVNForumConfig.isRequireRegisterLastname());
  326. }
  327. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberGender())) &&
  328. MVNForumConfig.getEnableShowGender() ) {
  329. memberGender = GenericParamUtil.getParameterBoolean(request, "MemberGender")? 1 : 0;
  330. memberGender = Integer.parseInt(GenericParamUtil.getParameterFilter(request, "MemberGender", MVNForumConfig.isRequireRegisterGender()));
  331. if (memberGender != 0 && memberGender != 1) {
  332. memberGender = 0;
  333. }
  334. }
  335. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberBirthday())) &&
  336. MVNForumConfig.getEnableShowBirthday() ) {
  337. String memberBirthdayStr = GenericParamUtil.getParameter(request, "MemberBirthday");
  338. if ( MVNForumConfig.isRequireRegisterBirthday() ||
  339. memberBirthdayStr.length() > 0 ) {
  340. memberBirthday = GenericParamUtil.getParameterDate(request, "MemberBirthday");
  341. }
  342. }
  343. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberAddress())) &&
  344. MVNForumConfig.getEnableShowAddress() ) {
  345. memberAddress = GenericParamUtil.getParameterFilter(request, "MemberAddress", MVNForumConfig.isRequireRegisterAddress());
  346. }
  347. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberCity())) &&
  348. MVNForumConfig.getEnableShowCity() ) {
  349. memberCity = GenericParamUtil.getParameterFilter(request, "MemberCity", MVNForumConfig.isRequireRegisterCity());
  350. }
  351. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberState())) &&
  352. MVNForumConfig.getEnableShowState() ) {
  353. memberState = GenericParamUtil.getParameterFilter(request, "MemberState", MVNForumConfig.isRequireRegisterState());
  354. }
  355. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberCountry())) &&
  356. MVNForumConfig.getEnableShowCountry() ) {
  357. memberCountry = GenericParamUtil.getParameterFilter(request, "MemberCountry", MVNForumConfig.isRequireRegisterCountry());
  358. }
  359. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberPhone())) &&
  360. MVNForumConfig.getEnableShowPhone() ) {
  361. memberPhone = GenericParamUtil.getParameterFilter(request, "MemberPhone", MVNForumConfig.isRequireRegisterPhone());
  362. }
  363. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberMobile())) &&
  364. MVNForumConfig.getEnableShowMobile() ) {
  365. memberMobile = GenericParamUtil.getParameterFilter(request, "MemberMobile", MVNForumConfig.isRequireRegisterMobile());
  366. }
  367. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberFax())) &&
  368. MVNForumConfig.getEnableShowFax() ) {
  369. memberFax = GenericParamUtil.getParameterFilter(request, "MemberFax", MVNForumConfig.isRequireRegisterFax());
  370. }
  371. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberCareer())) &&
  372. MVNForumConfig.getEnableShowCareer() ) {
  373. memberCareer = GenericParamUtil.getParameterFilter(request, "MemberCareer", MVNForumConfig.isRequireRegisterCareer());
  374. }
  375. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberHomepage())) &&
  376. MVNForumConfig.getEnableShowHomepage() ) {
  377. String memberHomepageStr = GenericParamUtil.getParameter(request, "MemberHomepage");
  378. if ( MVNForumConfig.isRequireRegisterHomepage() ||
  379. memberHomepageStr.length() > 0 ) {
  380. memberHomepage = GenericParamUtil.getParameterUrl(request, "MemberHomepage");
  381. }
  382. }
  383. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberYahoo())) &&
  384. MVNForumConfig.getEnableShowYahoo() ) {
  385. memberYahoo = GenericParamUtil.getParameterFilter(request, "MemberYahoo", MVNForumConfig.isRequireRegisterYahoo());
  386. }
  387. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberAol())) &&
  388. MVNForumConfig.getEnableShowAOL() ) {
  389. memberAol = GenericParamUtil.getParameterFilter(request, "MemberAol", MVNForumConfig.isRequireRegisterAol());
  390. }
  391. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberIcq())) &&
  392. MVNForumConfig.getEnableShowICQ() ) {
  393. memberIcq = GenericParamUtil.getParameterFilter(request, "MemberIcq", MVNForumConfig.isRequireRegisterIcq());
  394. }
  395. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberMsn())) &&
  396. MVNForumConfig.getEnableShowMSN() ) {
  397. memberMsn = GenericParamUtil.getParameterFilter(request, "MemberMsn", MVNForumConfig.isRequireRegisterMsn());
  398. }
  399. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberCoolLink1())) &&
  400. MVNForumConfig.getEnableShowCoolLink1() ) {
  401. String memberCoolLink1Str = GenericParamUtil.getParameter(request, "MemberCoolLink1");
  402. if ( MVNForumConfig.isRequireRegisterLink1() ||
  403. memberCoolLink1Str.length() > 0 ) {
  404. memberCoolLink1 = GenericParamUtil.getParameterUrl(request, "MemberCoolLink1");
  405. }
  406. }
  407. if ( (internalUserDatabase || MemberMapping.isLocalField(mapping.getMemberCoolLink2())) &&
  408. MVNForumConfig.getEnableShowCoolLink2() ) {
  409. String memberCoolLink2Str = GenericParamUtil.getParameter(request, "MemberCoolLink2");
  410. if ( MVNForumConfig.isRequireRegisterLink2() ||
  411. memberCoolLink2Str.length() > 0 ) {
  412. memberCoolLink2 = GenericParamUtil.getParameterUrl(request, "MemberCoolLink2");
  413. }
  414. }
  415. try {
  416. DAOFactory.getMemberDAO().update(memberID, // primary key
  417. memberEmailVisible, memberNameVisible, now/*memberModifiedDate*/,
  418. memberOption, memberStatus, memberMessageOption,
  419. memberPostsPerPage, memberTimeZone, memberSkin,
  420. memberLanguage, memberFirstname, memberLastname,
  421. memberGender, memberBirthday, memberAddress,
  422. memberCity, memberState, memberCountry,
  423. memberPhone, memberMobile, memberFax,
  424. memberCareer, memberHomepage, memberYahoo,
  425. memberAol, memberIcq, memberMsn,
  426. memberCoolLink1, memberCoolLink2);
  427. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.UpdateMemberProcess", new Object[]{new Integer(memberID)});
  428. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "update member", actionDesc, EventLogService.MEDIUM);
  429. } catch(ObjectNotFoundException ex) {
  430. Locale locale = I18nUtil.getLocaleInRequest(request);
  431. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  432. throw new ObjectNotFoundException(localizedMessage);
  433. }
  434. MemberBean justEditedMemberBean = DAOFactory.getMemberDAO().getMember(memberID);
  435. MemberIndexer.scheduleUpdateMemberTask(justEditedMemberBean);
  436. //request.setAttribute("MemberBean", justEditedMemberBean);
  437. }
  438. public void prepareView(GenericRequest request)
  439. throws BadInputException, ObjectNotFoundException, DatabaseException, AuthenticationException {
  440. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  441. MVNForumPermission permission = onlineUser.getPermission();
  442. permission.ensureCanModerateUser();
  443. Locale locale = I18nUtil.getLocaleInRequest(request);
  444. String strMemberID = GenericParamUtil.getParameter(request, "memberid", false);
  445. String strMemberName = GenericParamUtil.getParameter(request, "member", false);
  446. String strMemberEmail = GenericParamUtil.getParameter(request, "memberemail", false);
  447. int memberID;
  448. MemberBean memberBean = null;
  449. if (strMemberID.length() > 0) {
  450. memberID = GenericParamUtil.getParameterInt(request, "memberid");
  451. } else if (strMemberName.length() > 0) {
  452. /**@todo: improve this for better performance(don't use this method,
  453. * and write 2 new methods)*/
  454. StringUtil.checkGoodName(strMemberName);// check for better security
  455. try {
  456. memberID = DAOFactory.getMemberDAO().getMemberIDFromMemberName(strMemberName);
  457. } catch (ObjectNotFoundException e) {
  458. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.membername_not_exists", new Object[] {strMemberName});
  459. throw new ObjectNotFoundException(localizedMessage);
  460. }
  461. // now, in the LDAP case, we can get memberID from memberName does not mean user is in LDAP or not,
  462. // so we must check if the whole memberBean can be loaded or not
  463. try {
  464. memberBean = DAOFactory.getMemberDAO().getMember(memberID);
  465. } catch (ObjectNotFoundException e) {
  466. throw new ObjectNotFoundException("Member with login id = " + strMemberName + " has been deleted externally (for example, in LDAP) but the numeric id (" + memberID + ") still in the database.");
  467. }
  468. } else if (strMemberEmail.length() > 0) {
  469. String memberEmail = GenericParamUtil.getParameterEmail(request, "memberemail");// check for better security
  470. try {
  471. memberID = DAOFactory.getMemberDAO().getMemberIDFromMemberEmail(memberEmail);
  472. } catch (ObjectNotFoundException e) {
  473. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberemail_not_exists", new Object[] {memberEmail});
  474. throw new ObjectNotFoundException(localizedMessage);
  475. }
  476. } else {
  477. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.cannot_get_member_info");
  478. throw new BadInputException(localizedMessage);
  479. //throw new BadInputException("Cannot get the information to view member.");
  480. }
  481. // Update statistics to make sure Admin can delete this user
  482. // with the actual memberPostCount
  483. try {
  484. StatisticsUtil.updateMemberStatistics(memberID);
  485. } catch (ObjectNotFoundException e) {
  486. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  487. throw new ObjectNotFoundException(localizedMessage);
  488. }
  489. int toMessageCount = 0;
  490. int fromMessageCount = 0;
  491. String toDay = GenericParamUtil.getParameter(request, "toDay", false);
  492. String toMonth = GenericParamUtil.getParameter(request, "toMonth", false);
  493. String toYear = GenericParamUtil.getParameter(request, "toYear", false);
  494. String fromDay = GenericParamUtil.getParameter(request, "fromDay", false);
  495. String fromMonth = GenericParamUtil.getParameter(request, "fromMonth", false);
  496. String fromYear = GenericParamUtil.getParameter(request, "fromYear", false);
  497. if ( !toDay.equals("") &&
  498. !toMonth.equals("") &&
  499. !toYear.equals("") &&
  500. !fromDay.equals("") &&
  501. !fromMonth.equals("") &&
  502. !fromYear.equals("")) {
  503. Timestamp from = new Timestamp(GenericParamUtil.getParameterDate(request, "fromDay", "fromMonth", "fromYear").getTime());
  504. Timestamp to = new Timestamp(GenericParamUtil.getParameterDate(request, "toDay", "toMonth", "toYear").getTime());
  505. toMessageCount = DAOFactory.getMessageStatisticsDAO().getNumberOfBeans_inToID_supportTimestamp(memberID, from, to);
  506. fromMessageCount = DAOFactory.getMessageStatisticsDAO().getNumberOfBeans_inFromID_supportTimestamp(memberID, from, to);
  507. } else {
  508. toMessageCount = DAOFactory.getMessageStatisticsDAO().getNumberOfBeans_inToID(memberID);
  509. fromMessageCount = DAOFactory.getMessageStatisticsDAO().getNumberOfBeans_inFromID(memberID);
  510. }
  511. try {
  512. if (memberBean == null) {
  513. memberBean = DAOFactory.getMemberDAO().getMember(memberID);
  514. }
  515. } catch (ObjectNotFoundException e) {
  516. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  517. throw new ObjectNotFoundException(localizedMessage);
  518. }
  519. int watchCount = DAOFactory.getWatchDAO().getNumberOfWatches_forMember(memberID);
  520. request.setAttribute("MemberBean", memberBean);
  521. request.setAttribute("WatchCount", new Integer(watchCount));
  522. request.setAttribute("ToMessageCount", new Integer(toMessageCount));
  523. request.setAttribute("FromMessageCount", new Integer(fromMessageCount));
  524. request.setAttribute("toDay", toDay);
  525. request.setAttribute("toMonth", toMonth);
  526. request.setAttribute("toYear", toYear);
  527. request.setAttribute("fromDay", fromDay);
  528. request.setAttribute("fromMonth", fromMonth);
  529. request.setAttribute("fromYear", toYear);
  530. }
  531. public void processUpdateMemberTitle(GenericRequest request, GenericResponse response)
  532. throws BadInputException, DatabaseException, ObjectNotFoundException, AuthenticationException {
  533. SecurityUtil.checkHttpPostMethod(request);
  534. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  535. MVNForumPermission permission = onlineUser.getPermission();
  536. permission.ensureCanModerateUser();
  537. MyUtil.saveVNTyperMode(request, response);
  538. // primary key column(s)
  539. int memberID = GenericParamUtil.getParameterInt(request, "MemberID");
  540. // column(s) to update
  541. String memberTitle = GenericParamUtil.getParameterSafe(request, "MemberTitle", false);
  542. Locale locale = I18nUtil.getLocaleInRequest(request);
  543. try {
  544. DAOFactory.getMemberDAO().updateTitle(memberID, memberTitle);
  545. } catch (ObjectNotFoundException e) {
  546. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  547. throw new ObjectNotFoundException(localizedMessage);
  548. }
  549. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.UpdateMemberTitle", new Object[]{new Integer(memberID), memberTitle});
  550. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "update member title", actionDesc, EventLogService.MEDIUM);
  551. // clear the member cache
  552. MemberCache.getInstance().clear();
  553. }
  554. public void processResetMemberSignature(GenericRequest request)
  555. throws BadInputException, DatabaseException, ObjectNotFoundException, AuthenticationException {
  556. SecurityUtil.checkHttpReferer(request);
  557. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  558. MVNForumPermission permission = onlineUser.getPermission();
  559. permission.ensureCanModerateUser();
  560. Locale locale = I18nUtil.getLocaleInRequest(request);
  561. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  562. try {
  563. DAOFactory.getMemberDAO().updateSignature(memberID, "");
  564. } catch (ObjectNotFoundException e) {
  565. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  566. throw new ObjectNotFoundException(localizedMessage);
  567. }
  568. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.ResetMemberSignature", new Object[]{new Integer(memberID)});
  569. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "reset member signature", actionDesc, EventLogService.MEDIUM);
  570. request.setAttribute("MemberID", new Integer(memberID));
  571. }
  572. public void processResetMemberAvatar(GenericRequest request)
  573. throws BadInputException, DatabaseException, ObjectNotFoundException, AuthenticationException {
  574. SecurityUtil.checkHttpReferer(request);
  575. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  576. MVNForumPermission permission = onlineUser.getPermission();
  577. permission.ensureCanModerateUser();
  578. Locale locale = I18nUtil.getLocaleInRequest(request);
  579. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  580. try {
  581. DAOFactory.getMemberDAO().updateAvatar(memberID, "");
  582. } catch (ObjectNotFoundException e) {
  583. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  584. throw new ObjectNotFoundException(localizedMessage);
  585. }
  586. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.ResetMemberAvatar", new Object[]{new Integer(memberID)});
  587. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "reset member avatar", actionDesc, EventLogService.MEDIUM);
  588. request.setAttribute("MemberID", new Integer(memberID));
  589. }
  590. public void processResetMemberActivation(GenericRequest request)
  591. throws BadInputException, DatabaseException, ObjectNotFoundException, AuthenticationException {
  592. SecurityUtil.checkHttpReferer(request);
  593. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  594. MVNForumPermission permission = onlineUser.getPermission();
  595. permission.ensureCanModerateUser();// TODO: should check if we need AdminSystem permission to do this action
  596. Locale locale = I18nUtil.getLocaleInRequest(request);
  597. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  598. try {
  599. DAOFactory.getMemberDAO().updateActivateCode(memberID, "");
  600. } catch (ObjectNotFoundException e) {
  601. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  602. throw new ObjectNotFoundException(localizedMessage);
  603. }
  604. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.ResetMemberActivation", new Object[]{new Integer(memberID)});
  605. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "reset member activation", actionDesc, EventLogService.MEDIUM);
  606. request.setAttribute("MemberID", new Integer(memberID));
  607. }
  608. public void prepareDeleteMember(GenericRequest request)
  609. throws BadInputException, DatabaseException, ObjectNotFoundException, AuthenticationException {
  610. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  611. MVNForumPermission permission = onlineUser.getPermission();
  612. permission.ensureCanAdminSystem();
  613. Locale locale = I18nUtil.getLocaleInRequest(request);
  614. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  615. if ((memberID == MVNForumConstant.MEMBER_ID_OF_ADMIN) ||
  616. (memberID == 0) ||
  617. (memberID == onlineUser.getMemberID()) ||
  618. (memberID == MVNForumConstant.MEMBER_ID_OF_GUEST)) {
  619. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.cannot_delete_admin_or_guest");
  620. throw new BadInputException(localizedMessage);
  621. //throw new BadInputException("Cannot delete default Admin and Guest users.");
  622. }
  623. MemberBean memberBean = null;
  624. try {
  625. memberBean = DAOFactory.getMemberDAO().getMember(memberID);
  626. } catch (ObjectNotFoundException e) {
  627. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  628. throw new ObjectNotFoundException(localizedMessage);
  629. }
  630. request.setAttribute("MemberBean", memberBean);
  631. }
  632. public void processDeleteMember(GenericRequest request)
  633. throws BadInputException, DatabaseException, ObjectNotFoundException, AuthenticationException {
  634. SecurityUtil.checkHttpPostMethod(request);
  635. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  636. MVNForumPermission permission = onlineUser.getPermission();
  637. permission.ensureCanAdminSystem();
  638. Locale locale = I18nUtil.getLocaleInRequest(request);
  639. // now check the password
  640. MyUtil.ensureCorrectCurrentPassword(request);
  641. int memberID = GenericParamUtil.getParameterInt(request, "memberid");
  642. if ((memberID == MVNForumConstant.MEMBER_ID_OF_ADMIN) ||
  643. (memberID == 0) ||
  644. (memberID == onlineUser.getMemberID()) ||
  645. (memberID == MVNForumConstant.MEMBER_ID_OF_GUEST)) {
  646. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.cannot_delete_admin_or_guest");
  647. throw new BadInputException(localizedMessage);
  648. //throw new BadInputException("Cannot delete default Admin and Guest users.");
  649. }
  650. boolean deleteSentMessages = GenericParamUtil.getParameterBoolean(request, "deletesentmessages");
  651. MemberBean memberBean = null;
  652. try {
  653. memberBean = DAOFactory.getMemberDAO().getMember(memberID);
  654. } catch (ObjectNotFoundException e) {
  655. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.ObjectNotFoundException.memberid_not_exists", new Object[] {new Integer(memberID)});
  656. throw new ObjectNotFoundException(localizedMessage);
  657. }
  658. MemberWebHandler.deleteMember(memberBean, deleteSentMessages, /*context*/request, locale);
  659. String actionDesc = MVNForumResourceBundle.getString(MVNForumConfig.getEventLogLocale(), "mvnforum.eventlog.desc.DeleteMemberProcess", new Object[]{new Integer(memberID)});
  660. eventLogService.logEvent(onlineUser.getMemberName(), request.getRemoteAddr(), MVNForumConstant.EVENT_LOG_MAIN_MODULE, MVNForumConstant.EVENT_LOG_SUB_MODULE_ADMIN, "delete member", actionDesc, EventLogService.HIGH);
  661. }
  662. /**
  663. * This method supports sorting base on many criteria
  664. */
  665. public void prepareShowUserManagement(GenericRequest request)
  666. throws DatabaseException, BadInputException, AuthenticationException {
  667. OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
  668. MVNForumPermission permission = onlineUser.getPermission();
  669. permission.ensureCanModerateUser();
  670. Locale locale = I18nUtil.getLocaleInRequest(request);
  671. // for sort and order stuff
  672. String sort = GenericParamUtil.getParameter(request, "sort");
  673. String order = GenericParamUtil.getParameter(request, "order");
  674. if (sort.length() == 0) sort = "MemberCreationDate";
  675. if (order.length()== 0) order = "DESC";
  676. // we continue
  677. int postsPerPage = onlineUser.getPostsPerPage();
  678. int offset = 0;
  679. try {
  680. offset = GenericParamUtil.getParameterUnsignedInt(request, "offset");
  681. } catch (BadInputException e) {
  682. // do nothing
  683. }
  684. int totalMembers = 0;
  685. Collection memberBeans = new ArrayList ();
  686. int enabledMembers = 0;
  687. int pendingMembers = 0;
  688. int activatedMembers = 0;
  689. int nonactivatedMembers = 0;
  690. int disabledMembers = 0;
  691. if (DAOFactory.getMemberDAO().isSupportGetMembers_withSortSupport_limit()) {
  692. if (DAOFactory.getMemberDAO().isSupportGetNumberOfMembers()) {
  693. totalMembers = DAOFactory.getMemberDAO().getNumberOfMembers();
  694. }
  695. if (offset > totalMembers) {
  696. String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.BadInputException.offset_greater_than_total_rows");
  697. throw new BadInputException(localizedMessage);
  698. //throw new BadInputException("The offset is not allowed to be greater than total rows.");
  699. }
  700. memberBeans = DAOFactory.getMemberDAO().getMembers_withSortSupport_limit(offset, postsPerPage, sort, order, MemberDAO.ALL_MEMBER_STATUS);
  701. if (DAOFactory.getMemberDAO().isSupportGetNumberOfMembers_inActivationStatus()) {
  702. activatedMembers = DAOFactory.getMemberDAO().getNumberOfMembers_inActivationStatus(true);
  703. nonactivatedMembers = DAOFactory.getMemberDAO().getNumberOfMembers_inActivationStatus(false);
  704. if ((activatedMembers + nonactivatedMembers) != totalMembers) {
  705. // please do not localize this
  706. throw new AssertionError("Assertion: (activatedMembers + nonactivatedMembers) == totalMembers");
  707. }
  708. }
  709. if (DAOFactory.getMemberDAO().isSupportGetNumberOfMembers_inMemberStatus()) {
  710. disabledMembers = DAOFactory.getMemberDAO().getNumberOfMembers_inMemberStatus(MemberBean.MEMBER_STATUS_DISABLE);
  711. enabledMembers = DAOFactory.getMemberDAO().getNumberOfMembers_inMemberStatus(MemberBean.MEMBER_STATUS_ENABLE);
  712. pendingMembers = DAOFactory.getMemberDAO().getNumberOfMembers_inMemberStatus(MemberBean.MEMBER_STATUS_PENDING);
  713. if ((disabledMembers + enabledMembers + pendingMembers) != totalMembers) {
  714. // please do not localize this
  715. throw new AssertionError("Assertion: (disabledMembers + enabledMembers + pendingMembers) == totalMembers");
  716. }
  717. }