Commit ab9a3dfd authored by Liang Ding's avatar Liang Ding

Merge pull request #122 from b3log/0.5.5

0.5.5
parents cf566c0f eba75ced
......@@ -41,7 +41,7 @@ import org.json.JSONObject;
* This listener is responsible for sending article to B3log Rhythm.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.2.1, Oct 18, 2012
* @version 1.0.2.2, Nov 2, 2012
* @since 0.3.1
*/
public final class ArticleSender extends AbstractEventListener<JSONObject> {
......@@ -61,7 +61,7 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
/**
* B3log Rhythm address.
*/
public static final String B3LOG_RHYTHM_ADDRESS = "http://rhythm.b3log.org:11000";
public static final String B3LOG_RHYTHM_ADDRESS = "http://rhythm.b3log.org:80";
/**
* URL of adding article to Rhythm.
*/
......
......@@ -23,8 +23,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.RuntimeEnv;
import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.servlet.HTTPRequestContext;
import org.b3log.latke.servlet.HTTPRequestMethod;
......@@ -37,13 +35,14 @@ import org.b3log.solo.model.Common;
import org.b3log.solo.model.Page;
import org.b3log.solo.service.CommentMgmtService;
import org.b3log.solo.util.Comments;
import org.b3log.solo.util.Users;
import org.json.JSONObject;
/**
* Comment processor.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.1.0.8, Sep 10, 2012
* @version 1.1.0.9, Nov 2, 2012
* @since 0.3.1
*/
@RequestProcessor
......@@ -115,12 +114,17 @@ public final class CommentProcessor {
return;
}
if (RuntimeEnv.BAE != Latkes.getRuntimeEnv()) {
final String captcha = requestJSONObject.optString(CaptchaProcessor.CAPTCHA);
final HttpSession session = httpServletRequest.getSession(false);
if (null != session) {
if (null == session) {
jsonObject.put(Keys.STATUS_CODE, false);
jsonObject.put(Keys.MSG, langPropsService.get("captchaErrorLabel"));
return;
}
if (!Users.getInstance().isLoggedIn(httpServletRequest, httpServletResponse)) {
final String storedCaptcha = (String) session.getAttribute(CaptchaProcessor.CAPTCHA);
final String captcha = requestJSONObject.optString(CaptchaProcessor.CAPTCHA);
if (null == storedCaptcha || !storedCaptcha.equals(captcha)) {
jsonObject.put(Keys.STATUS_CODE, false);
jsonObject.put(Keys.MSG, langPropsService.get("captchaErrorLabel"));
......@@ -130,7 +134,6 @@ public final class CommentProcessor {
session.removeAttribute(CaptchaProcessor.CAPTCHA);
}
}
try {
final JSONObject addResult = commentMgmtService.addPageComment(requestJSONObject);
......@@ -198,12 +201,17 @@ public final class CommentProcessor {
return;
}
if (RuntimeEnv.BAE != Latkes.getRuntimeEnv()) {
final String captcha = requestJSONObject.optString(CaptchaProcessor.CAPTCHA);
final HttpSession session = httpServletRequest.getSession(false);
if (null != session) {
if (null == session) {
jsonObject.put(Keys.STATUS_CODE, false);
jsonObject.put(Keys.MSG, langPropsService.get("captchaErrorLabel"));
return;
}
if (!Users.getInstance().isLoggedIn(httpServletRequest, httpServletResponse)) {
final String storedCaptcha = (String) session.getAttribute(CaptchaProcessor.CAPTCHA);
final String captcha = requestJSONObject.optString(CaptchaProcessor.CAPTCHA);
if (null == storedCaptcha || !storedCaptcha.equals(captcha)) {
jsonObject.put(Keys.STATUS_CODE, false);
jsonObject.put(Keys.MSG, langPropsService.get("captchaErrorLabel"));
......@@ -213,7 +221,6 @@ public final class CommentProcessor {
session.removeAttribute(CaptchaProcessor.CAPTCHA);
}
}
try {
final JSONObject addResult = commentMgmtService.addArticleComment(requestJSONObject);
......
......@@ -49,4 +49,4 @@ cache=BAE
userService=LOCAL
#### Static resource version ####
staticResourceVersion=201206280945
\ No newline at end of file
staticResourceVersion=201211021410
\ No newline at end of file
......@@ -48,4 +48,4 @@ cache=GAE
userService=LOCAL
#### Static resource version ####
staticResourceVersion=201206280945
\ No newline at end of file
staticResourceVersion=201211021410
\ No newline at end of file
......@@ -24,10 +24,10 @@
# Configures the followings before deploy
serverScheme=http
serverHost=localhost
serverPort=11099
serverPort=8080
staticServerScheme=http
staticServerHost=localhost
staticServerPort=11099
staticServerPort=8080
# Note: The context path and static path should be "" if deploy app on ROOT. For other cases, starts with '/'
# and not ends with '/', for example, /blog
contextPath=
......@@ -48,4 +48,4 @@ cache=LOCAL
userService=LOCAL
#### Static resource version ####
staticResourceVersion=201206280945
\ No newline at end of file
staticResourceVersion=201211021410
\ No newline at end of file
......@@ -19,7 +19,7 @@
"url(${staticServePath}/images/loader.gif) no-repeat scroll center center transparent");
$.ajax({
url: "http://symphony.b3log.org:80/get-news",
url: "http://localhost:8080/apis/news",
type: "GET",
dataType:"jsonp",
jsonp: "callback",
......@@ -37,7 +37,7 @@
var article = articles[i];
var articleLiHtml = "<li>"
+ "<a target='_blank' href='" + article.articlePermalink + "'>"
+ article.articleTitle + "</a>&nbsp; <span class='date'>" + $.bowknot.getDate(article.articleCreateDate, 1); + "</span></li>"
+ article.articleTitle + "</a>&nbsp; <span class='date'>" + $.bowknot.getDate(article.articleCreateTime, 1); + "</span></li>"
listHTML += articleLiHtml
}
listHTML += "</ul>";
......
......@@ -16,13 +16,13 @@
#
# Description: Description of plugin symphony-news-getter.
# Version: 1.0.0.1, Oct 30, 2011
# Version: 1.0.0.2, Nov 8, 2012
# Author: Liang Ding
#
author=<a href="http://88250.b3log.org">88250</a> & <a href="http://vanessa.b3log.org">Vanessa</a>
name=Symphony News Getter
version=0.0.2
version=0.0.3
types=ADMIN
classesDirPath=/WEB-INF/classes/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment