Examples of WebsiteData


Examples of org.apache.roller.pojos.WebsiteData

           
            List websiteDatas = new ArrayList();
            for (int i = 0; i < c.getEntries().length; i++) {
                WeblogEntry entry = (WeblogEntry)c.getEntries()[i];
                UserData user = mgr.getUserByUsername(entry.getCreatingUser());
                WebsiteData wd = new WebsiteData(
                        entry.getHandle(),
                        user,
                        entry.getName(),
                        entry.getDescription(),
                        entry.getEmailAddress(),
                        entry.getEmailAddress(),
                        DEFAULT_THEME,
                        entry.getLocale().toString(),
                        entry.getTimezone().getID());
               
                Date dateCreated  = entry.getDateCreated();
                if (dateCreated == null) {
                    dateCreated = new Date();
                }
                wd.setDateCreated(dateCreated);
               
                try {
                    String def = RollerRuntimeConfig.getProperty("users.editor.pages");
                    String[] defs = Utilities.stringToStringArray(def,",");
                    wd.setEditorPage(defs[0]);
                } catch (Exception ex) {
                    log.error("ERROR setting default editor page for weblog", ex);
                }
               
                mgr.addWebsite(wd);
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

            HashMap pages = null;
           
            List websiteDatas = new ArrayList();
            for (int i = 0; i < c.getEntries().length; i++) {
                WeblogEntry entry = (WeblogEntry)c.getEntries()[i];
                WebsiteData wd = mgr.getWebsiteByHandle(entry.getHandle());
                if (wd == null) {
                    throw new NotFoundException("ERROR: Unknown weblog: " + entry.getHandle());
                }
                updateWebsiteData(wd, entry);
                websiteDatas.add(wd);
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

        String handle = getUri().getEntryId();
       
        try {
            UserManager mgr = getRoller().getUserManager();
           
            WebsiteData wd = mgr.getWebsiteByHandle(handle);
            if (wd == null) {
                throw new NotFoundException("ERROR: Unknown weblog handle: " + handle);
            }
           
            WebsiteData[] wds = new WebsiteData[] { wd };
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

        for (int i = 0; i < uds.length; i++) {
            UserData ud = uds[i];
            List permissions = ud.getPermissions();
            for (Iterator j = permissions.iterator(); j.hasNext(); ) {
                PermissionsData pd = (PermissionsData)j.next();
                WebsiteData wd = pd.getWebsite();
                WeblogEntry we = toWeblogEntry(wd);
                entries.add(we);
            }
        }
        wes.setEntries((Entry[])entries.toArray(new Entry[0]));
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

                error = "title, url, excerpt, and blog_name not specified.";
            }
            else {               
                RollerRequest rreq = RollerRequest.getRollerRequest(req);
                WeblogEntryData entry = rreq.getWeblogEntry();
                WebsiteData website = entry.getWebsite();
                boolean siteAllows = website.getAllowComments().booleanValue();
               
                if (entry!=null && siteAllows && entry.getCommentsStillAllowed()) {
                   
                    // Track trackbacks as comments
                    CommentData comment = new CommentData();
                    comment.setContent("[Trackback] "+excerpt);
                    comment.setName(blogName);
                    comment.setUrl(url);
                    comment.setWeblogEntry(entry);
                    comment.setNotify(Boolean.FALSE);
                    comment.setPostTime(new Timestamp(new Date().getTime()));
                   
                    // If comment contains blacklisted text, mark as spam
                    SpamChecker checker = new SpamChecker();
                    if (checker.checkTrackback(comment)) {
                       comment.setSpam(Boolean.TRUE);
                       logger.debug("Trackback blacklisted: "+comment.getUrl());
                       error = "REJECTED: trackback contains spam words";
                    }
                    // Else, if trackback verification is on...
                    else if (RollerRuntimeConfig.getBooleanProperty(
                           "site.trackbackVerification.enabled")) {
                       
                        // ...ensure trackbacker actually links to us
                        RollerContext rctx= RollerContext.getRollerContext();
                        String absurl = rctx.getAbsoluteContextUrl(req);
                        LinkbackExtractor linkback = new LinkbackExtractor(
                            comment.getUrl(), absurl + entry.getPermaLink());
                        if (linkback.getExcerpt() == null) {
                           comment.setPending(Boolean.TRUE);
                           comment.setApproved(Boolean.FALSE);
                           verified = false;
                           // if we can't verify trackback, then reject it
                           error = "REJECTED: trackback failed verification";
                           logger.debug("Trackback failed verification: "+comment.getUrl());
                        }
                    }
                   
                    if (error == null) {
                        // If comment moderation is on, set comment as pending
                        if (verified && website.getCommentModerationRequired()) {
                            comment.setPending(Boolean.TRUE);  
                            comment.setApproved(Boolean.FALSE);
                        } else if (verified) {
                            comment.setPending(Boolean.FALSE);  
                            comment.setApproved(Boolean.TRUE);
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

        PageHelper pageHelper = new PageHelper(request, response, ctx);
        Roller roller = RollerFactory.getRoller();
        ctx.put("pageHelper", pageHelper);
               
        // Load standard Roller objects and values into the context
        WebsiteData website =
            loadWeblogValues(ctx, rreq, rollerCtx );
        loadPathValues(       ctx, rreq, rollerCtx, website );
        loadRssValues(        ctx, rreq, website );
        loadUtilityObjects(   ctx, rreq, rollerCtx, website );
        loadRequestParamKeys( ctx);
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

            throws RollerException {
               
        Roller mRoller = RollerFactory.getRoller();
        Map props = mRoller.getPropertiesManager().getProperties();
       
        WebsiteData weblog = rreq.getWebsite();           
        if (weblog == null && rreq.getRequest().getParameter("entry") != null) {
            String handle = rreq.getRequest().getParameter("entry");
            weblog = RollerFactory.getRoller().getUserManager().getWebsiteByHandle(handle);
        }
        if (weblog == null && rreq.getRequest().getAttribute(RollerRequest.OWNING_WEBSITE) != null) {
            weblog = (WebsiteData)rreq.getRequest().getAttribute(RollerRequest.OWNING_WEBSITE);
        }
       
        if (weblog != null) {
            ctx.put("userName",         weblog.getHandle());
            ctx.put("fullName",         weblog.getName() );
            ctx.put("emailAddress",     weblog.getEmailAddress() );
            ctx.put("encodedEmail",     RegexUtil.encode(weblog.getEmailAddress()));
            ctx.put("obfuscatedEmail",  RegexUtil.obfuscateEmail(weblog.getEmailAddress()));
           
            // setup Locale for future rendering
            ctx.put("locale", weblog.getLocaleInstance());
           
            // setup Timezone for future rendering
            ctx.put("timezone", weblog.getTimeZoneInstance());
            ctx.put("timeZone", weblog.getTimeZoneInstance());
        } else {
            // create dummy website for use in site-wide feeds
            weblog = new WebsiteData();
            weblog.setAllowComments(Boolean.FALSE);
            weblog.setHandle("zzz_none_zzz");
            weblog.setName(
                ((RollerPropertyData)props.get("site.name")).getValue());
            weblog.setDescription(
                ((RollerPropertyData)props.get("site.description")).getValue());
            weblog.setEntryDisplayCount(
                RollerRuntimeConfig.getIntProperty("site.newsfeeds.defaultEntries"));
            ctx.put("handle",   weblog.getHandle() );
            ctx.put("userName", weblog.getHandle() );
            ctx.put("fullName", weblog.getHandle());
            ctx.put("locale",   Locale.getDefault());
            ctx.put("timezone", TimeZone.getDefault());
            ctx.put("timeZone", TimeZone.getDefault());
            ctx.put("emailAddress",
                ((RollerPropertyData)props.get("site.adminemail")).getValue());          
        }
        ctx.put("website", WebsiteDataWrapper.wrap(weblog) );
       
        String siteName = ((RollerPropertyData)props.get("site.name")).getValue();
        if ("Roller-based Site".equals(siteName)) siteName = "Main";
        ctx.put("siteName", siteName);
       
        String siteShortName = ((RollerPropertyData)props.get("site.shortName")).getValue();
        ctx.put("siteShortName", siteShortName);
       
        // add language of the session (using locale of viewer set by Struts)
        ctx.put("viewLocale",
                LanguageUtil.getViewLocale(rreq.getRequest()));
        mLogger.debug("context viewLocale = "+ctx.get( "viewLocale"));
              
        // if there is an "_entry" page, only load it once
        // but don't do it for dummy website
        if (weblog != null && !"zzz_none_zzz".equals(weblog.getHandle())) {
            // alternative display pages - customization
            Template entryPage = weblog.getPageByName("_entry");
            if (entryPage != null) {
                ctx.put("entryPage", TemplateWrapper.wrap(entryPage));
            }
            Template descPage = weblog.getPageByName("_desc");
            if (descPage != null) {
                ctx.put("descPage", TemplateWrapper.wrap(descPage));
            }
        }
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

            reqsb.append(request.getQueryString());
        }
        String requestUrl = reqsb.toString();
       
        // parse the incoming request and make sure it's a valid page request
        WebsiteData weblog = null;
        WeblogPageRequest pageRequest = null;
        try {
            pageRequest = new WeblogPageRequest(request);
            UserManager userMgr = RollerFactory.getRoller().getUserManager();
            weblog = userMgr.getWebsiteByHandle(pageRequest.getWeblogHandle());
           
            if(weblog == null) {
                throw new Exception("no weblog named "+pageRequest.getWeblogHandle());
            }
           
        } catch(Exception ex) {
            // bad url or couldn't obtain weblog
            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        }
       
        // determine if this request came from a robot
        if (robotPattern != null) {
            // If the pattern is present, we check for whether the User-Agent matches,
            // and set isRobot if so.  Currently, all referral processing, including
            // spam check, is skipped for robots identified in this way.
            String userAgent = request.getHeader("User-Agent");
            isRobot = (userAgent != null && userAgent.length() > 0 && robotPattern.matcher(userAgent).matches());
        }
       
        // validate the referrer
        if (pageRequest != null && pageRequest.getWeblogHandle() != null && !isRobot) {
           
            RollerContext rctx = RollerContext.getRollerContext();
           
            // Base page URLs, with and without www.
            String basePageUrlWWW =
                    rctx.getAbsoluteContextUrl(request)+"/page/"+weblog.getHandle();
            String basePageUrl = basePageUrlWWW;
            if ( basePageUrlWWW.startsWith("http://www.") ) {
                // chop off the http://www.
                basePageUrl = "http://"+basePageUrlWWW.substring(11);
            }
           
            // ignore referrers coming from users own blog
            if (referrerUrl == null ||
                    (!referrerUrl.startsWith(basePageUrl) &&
                    !referrerUrl.startsWith(basePageUrlWWW))) {
               
                String selfSiteFragment = "/page/"+weblog.getHandle();

                // validate the referrer
                if ( referrerUrl != null ) {
                    // ignore a Referrer from the persons own blog
                    if (referrerUrl.indexOf(selfSiteFragment) != -1) {
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

                                Context ctx)
        throws Exception {
       
        Template outty = null;
        RollerRequest rreq = null;
        WebsiteData website = null;
       
        PageContext pageContext =
            JspFactory.getDefaultFactory().getPageContext(
            this, request, response,"", true, 8192, true);

        // first off lets parse the incoming request and validate it
        try {
            rreq = RollerRequest.getRollerRequest(pageContext);
        } catch (Throwable t) {
            // NOTE: indicates real problem, not just a "not found" error
            throw new Exception("ERROR: creating RollerRequest");
        }

        // All pages exist within website, so website MUST be specified
        website = rreq.getWebsite();
        if (website == null) {
            response.sendError(HttpServletResponse.SC_NOT_FOUND);
            return null;
        }
              
        // request appears to be valid, lets render
        try {
            org.apache.roller.pojos.Template page = null;
           
            // If this is a popup request, then deal with it specially
            if(request.getParameter("popup") != null) {
                try {
                    // Does user have a popupcomments page?
                    page = website.getPageByName("_popupcomments");
                } catch(Exception e ) {
                    // ignored ... considered page not found
                }
               
                // User doesn't have one so return the default
                if(page == null) {
                    page = new WeblogTemplate("/popupcomments.vm", website,
                            "Comments", "Comments", "dummy_link",
                            "dummy_template", new Date());
                }
               
                rreq.setPage(page);
               
            // If request specified the page, then go with that
            } else if (rreq.getPage() != null) {
                page = rreq.getPage();
               
            // If page not available from request, then use website's default
            } else {
                page = website.getDefaultPage();
                rreq.setPage(page);
            }
           
            // Still no page ID, then we have a problem
            if ( page == null ) {
View Full Code Here

Examples of org.apache.roller.pojos.WebsiteData

                                Context ctx)
            throws IOException {
       
        Template template = null;
        WeblogRequest weblogRequest = null;
        WebsiteData weblog = null;
       
        // first off lets parse the incoming request and validate it
        try {
            weblogRequest = new WeblogRequest(request);
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.