Package org.jresearch.gossip.beans.user

Examples of org.jresearch.gossip.beans.user.User


    public ActionForward execute(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
        ForumDAO dao = ForumDAO.getInstance();
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        List updatedTopics = null;
        ActionForward forward = null;
        String fid =  ((ProcessForumForm) form).getFid();

        try {
View Full Code Here


        UserDAO userdao = UserDAO.getInstance();
        ForumDAO forumdao = ForumDAO.getInstance();
        ProcessUserForm puForm = (ProcessUserForm) form;
        try {

            User userToShow = userdao.getUserInfo(puForm.getUid());
            request.setAttribute(IConst.REQUEST.USER_TO_SHOW, userToShow);

            ArrayList userModForums = forumdao.getUserModForums(userToShow.getName());

            if (userModForums.size() > 0) {
                request.setAttribute(IConst.REQUEST.USER_MOD_FORUMS,
                    userModForums);
            }
View Full Code Here

        ForumDAO dao = ForumDAO.getInstance();
        UserDAO userdao = UserDAO.getInstance();
        HttpSession session = request.getSession();

        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        int fid = Integer.parseInt(pfForm.getFid());

        try {
         
            Forum currForum = dao.getForumInfo(fid);

            //check access rights if forum invisible
            if ((currForum.getLocked() == IConst.Forum.STATUS_INVISIBLE) &&
                    (user.getStatus() < Integer.parseInt(
                        Configurator.getInstance().get(IConst.CONFIG.INVADER1)))) {
                return (mapping.findForward(IConst.TOKEN.DENIED));
            }

            request.setAttribute(IConst.REQUEST.CURR_FORUM, currForum);
View Full Code Here

   */
  public ActionForward process(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws SystemException {
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
    ProcessTopicForm ptForm = (ProcessTopicForm) form;
    ForumDAO dao = ForumDAO.getInstance();
    try {
     
      dao.subscribe(ptForm.getTid(), user.getInfo().getEmail(), user
          .getName());
      setStatusMessage(request, "mails.CONFIRM_SUBSCR");
    } catch (SQLException sqle) {
      getServlet().log("Connection.process", sqle);
      throw new SystemException(sqle);
View Full Code Here

     * @param append
     *            DOCUMENT ME!
     */
    public void log(HttpServletRequest request, String mess, String append) {
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        MessageResources messages = getResources(request);

        StringBuffer sb = new StringBuffer();
        sb.append(messages.getMessage(mess));
        sb.append(" ");
View Full Code Here

                    || (((Date) session
                            .getAttribute(IConst.SESSION.LAST_UPDATE_DATE))
                            .before((Date) getServlet().getServletContext()
                                    .getAttribute(
                                            IConst.CONTEXT.LAST_UPDATE_DATE)))) {
                User user = (User) session
                        .getAttribute(IConst.SESSION.USER_KEY);
                session.setAttribute(IConst.SESSION.GROUPS_KEY, forumDAO
                        .getGroups(user.getStatus(), false));
                session.setAttribute(IConst.SESSION.LAST_UPDATE_DATE,
                        new Date());
            }
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
View Full Code Here

            HttpServletRequest request, HttpServletResponse response)
            throws SystemException {
        MessageResources messages = getResources(request);
        HttpSession session = request.getSession();
        SendAdminMailForm samForm = (SendAdminMailForm) form;
        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        UserDAO dao = UserDAO.getInstance();
        MessageProcessor mp = MessageProcessor.getInstance();
        String mess = mp.prepareMessage(HtmlCodec.encode(samForm.getText()), 0,
                messages);
        StringBuffer siteUrl = new StringBuffer();
        siteUrl.append(request.getServerName());
        siteUrl.append(":");
        siteUrl.append(request.getServerPort());
        siteUrl.append(request.getContextPath());
        siteUrl.append(Configurator.getInstance().get(
                IConst.CONFIG.MODULE_PREFIX));
        siteUrl.append("/");
        /*
         * {0} - login {1} - message text {2} - site url {3} - site name
         */
        Object[] messArgs = new Object[] { "", mp.nl2br(mess),
                siteUrl.toString(),
                Configurator.getInstance().get(IConst.CONFIG.SITE_NAME) };
        MailQueue queue = (MailQueue) session.getServletContext().getAttribute(
                IConst.CONTEXT.MAIL_QUEUE);
        try {

            ArrayList userMails = dao.getUserEmails();
            Iterator it = userMails.iterator();
            BanGuard guard = BanGuard.getInstance();
            while (it.hasNext()) {
                NamedValue nv = (NamedValue) it.next();

                if (!guard.checkBan(nv.getValue(), BanType.EMAIL)
                        && !user.getName().equals(nv.getName())) {
                    messArgs[0] = nv.getName();
                    queue.push(new MailMessage(messages.getMessage(
                            "mails.ADMIN_MAIL", messArgs),
                            samForm.getSubject(), Configurator.getInstance()
                                    .get(IConst.CONFIG.ADMINMAIL), user
                                    .getName(), nv.getValue(), nv.getName()));
                }
            }
            request.removeAttribute("sendAdminMailForm");
            log(request, "status.ADMIN_MAIL_SENT");
View Full Code Here

        ForumDAO dao = ForumDAO.getInstance();
        UserDAO userdao = UserDAO.getInstance();
        HttpSession session = request.getSession();

        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);

        try {
           

            RecordsData recordsData = new RecordsData();
View Full Code Here

        // Extract attributes we will need
        HttpSession session = request.getSession();
        MessageResources messages = getResources(request);
        LogonForm logonForm = (LogonForm) form;
        User user = new User();

        ActionErrors errors = new ActionErrors();

        String username = logonForm.getUsername();
        String password = logonForm.getPassword();

        UserDAO userDAO = UserDAO.getInstance();

        try {

            user = userDAO.getUser(username, password);
            user.setIp(request.getRemoteAddr());

            if (user.getStatus() == 0) {
                errors.add(ActionErrors.GLOBAL_ERROR,
                    new ActionError("forum.LOG_FAIL",
                        new Object[] {
                            response.encodeURL("showFogotPass.do?uid=" +
                                username)
                        }));
                JGossipLog.audit(
          LogLevel.WARN,
          user,
          messages.getMessage("logs.LOG2")+" \""+username+"\"",
          session);
            } else {
                session.setAttribute(IConst.SESSION.USER_KEY, user);
                session.removeAttribute(IConst.SESSION.GROUPS_KEY);
                log(request, "logs.LOG1");
            }
        } catch (SQLException sqle) {
            getServlet().log("Connection.process", sqle);
            throw new SystemException(sqle);
        }

        // Report any errors we have discovered back to the original form
        if (!errors.isEmpty()) {
            saveErrors(request, errors);

            return (mapping.getInputForward());
        }

        if (IConst.VALUES.TRUE.equals(Configurator.getInstance().get(IConst.CONFIG.ENABLE_AUTO_LOGIN))) {
            //set autolog cookies if needed...
            if (user.getSettings().isAutologin()) {
                Cookie userCookie = new Cookie(IConst.COOKIE.USER_COOKIE,
                        user.getName() + "*" + user.getPassword());
                userCookie.setMaxAge(IConst.COOKIE.SECONDS_PER_YEAR);
                ((HttpServletResponse) response).addCookie(userCookie);
            }
        }

View Full Code Here

    ForumDAO dao = ForumDAO.getInstance();
    HttpSession session = request.getSession();
    ActionErrors errors = new ActionErrors();
    MessageResources messages = getResources(request);
    SubscribeForm sForm = (SubscribeForm) form;
    User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
    String uname = null;
    String inputForward = null;
    String email = null;
    if (user.getStatus() == 0) {
      inputForward = "unsubscribe";
      if ((sForm.getEmail() == null) || sForm.getEmail().equals("")) {
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
            "errors.required", new Object[]{messages
                .getMessage("user.U_MAIL")}));
        saveErrors(request, errors);
        return (mapping.findForward(inputForward));
      } else {
        email = sForm.getEmail();
        uname = "<%>";
      }
    } else {
      inputForward = "subscriptions";
      uname = user.getName();
      email = user.getInfo().getEmail();
    }
    try {
     
      if (dao.unsubscribe(email, uname, sForm.getTid())) {
        if (user.getStatus() == 0) {
          setStatusMessage(request, "mails.OK1");
        }
      } else if (user.getStatus() == 0) {
        errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
            "mails.NOSUB2"));
        saveErrors(request, errors);
      }
    } catch (SQLException sqle) {
View Full Code Here

TOP

Related Classes of org.jresearch.gossip.beans.user.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.