Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
1213c33a
Commit
1213c33a
authored
Dec 19, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
536c663f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
14 deletions
+4
-14
src/main/java/org/b3log/solo/service/CommentMgmtService.java
src/main/java/org/b3log/solo/service/CommentMgmtService.java
+2
-2
src/main/java/org/b3log/solo/service/CommentQueryService.java
...main/java/org/b3log/solo/service/CommentQueryService.java
+2
-12
No files found.
src/main/java/org/b3log/solo/service/CommentMgmtService.java
View file @
1213c33a
...
@@ -352,12 +352,12 @@ public class CommentMgmtService {
...
@@ -352,12 +352,12 @@ public class CommentMgmtService {
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
// XSS process
//
name
XSS process
commentName
=
Jsoup
.
clean
(
commentName
,
Whitelist
.
none
());
commentName
=
Jsoup
.
clean
(
commentName
,
Whitelist
.
none
());
requestJSONObject
.
put
(
Comment
.
COMMENT_NAME
,
commentName
);
requestJSONObject
.
put
(
Comment
.
COMMENT_NAME
,
commentName
);
commentContent
=
commentContent
.
replaceAll
(
"\\n"
,
"<br/>\n"
);
commentContent
=
commentContent
.
replaceAll
(
"\\n"
,
"<br/>\n"
);
// content Markdown & XSS process
commentContent
=
Markdowns
.
toHTML
(
commentContent
);
commentContent
=
Markdowns
.
toHTML
(
commentContent
);
commentContent
=
Jsoup
.
clean
(
commentContent
,
Whitelist
.
relaxed
());
commentContent
=
Jsoup
.
clean
(
commentContent
,
Whitelist
.
relaxed
());
requestJSONObject
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
requestJSONObject
.
put
(
Comment
.
COMMENT_CONTENT
,
commentContent
);
...
...
src/main/java/org/b3log/solo/service/CommentQueryService.java
View file @
1213c33a
...
@@ -49,7 +49,7 @@ import org.jsoup.safety.Whitelist;
...
@@ -49,7 +49,7 @@ import org.jsoup.safety.Whitelist;
* Comment query service.
* Comment query service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.0.
6, Dec 17
, 2015
* @version 1.1.0.
7, Dec 19
, 2015
* @since 0.3.5
* @since 0.3.5
*/
*/
@Service
@Service
...
@@ -194,11 +194,6 @@ public class CommentQueryService {
...
@@ -194,11 +194,6 @@ public class CommentQueryService {
comment
.
put
(
Comment
.
COMMENT_TIME
,
((
Date
)
comment
.
get
(
Comment
.
COMMENT_DATE
)).
getTime
());
comment
.
put
(
Comment
.
COMMENT_TIME
,
((
Date
)
comment
.
get
(
Comment
.
COMMENT_DATE
)).
getTime
());
comment
.
remove
(
Comment
.
COMMENT_DATE
);
comment
.
remove
(
Comment
.
COMMENT_DATE
);
String
content
=
comment
.
getString
(
Comment
.
COMMENT_CONTENT
);
content
=
Markdowns
.
toHTML
(
content
);
content
=
Jsoup
.
clean
(
content
,
Whitelist
.
relaxed
());
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
content
);
}
}
final
int
pageCount
=
result
.
getJSONObject
(
Pagination
.
PAGINATION
).
getInt
(
Pagination
.
PAGINATION_PAGE_COUNT
);
final
int
pageCount
=
result
.
getJSONObject
(
Pagination
.
PAGINATION
).
getInt
(
Pagination
.
PAGINATION_PAGE_COUNT
);
...
@@ -224,7 +219,7 @@ public class CommentQueryService {
...
@@ -224,7 +219,7 @@ public class CommentQueryService {
*
*
* @param onId the specified on id
* @param onId the specified on id
* @return a list of comments, returns an empty list if not found
* @return a list of comments, returns an empty list if not found
* @throws ServiceException
repository
exception
* @throws ServiceException
service
exception
*/
*/
public
List
<
JSONObject
>
getComments
(
final
String
onId
)
throws
ServiceException
{
public
List
<
JSONObject
>
getComments
(
final
String
onId
)
throws
ServiceException
{
try
{
try
{
...
@@ -233,11 +228,6 @@ public class CommentQueryService {
...
@@ -233,11 +228,6 @@ public class CommentQueryService {
final
List
<
JSONObject
>
comments
=
commentRepository
.
getComments
(
onId
,
1
,
Integer
.
MAX_VALUE
);
final
List
<
JSONObject
>
comments
=
commentRepository
.
getComments
(
onId
,
1
,
Integer
.
MAX_VALUE
);
for
(
final
JSONObject
comment
:
comments
)
{
for
(
final
JSONObject
comment
:
comments
)
{
String
content
=
comment
.
getString
(
Comment
.
COMMENT_CONTENT
);
content
=
Markdowns
.
toHTML
(
content
);
content
=
Jsoup
.
clean
(
content
,
Whitelist
.
relaxed
());
comment
.
put
(
Comment
.
COMMENT_CONTENT
,
content
);
comment
.
put
(
Comment
.
COMMENT_TIME
,
((
Date
)
comment
.
get
(
Comment
.
COMMENT_DATE
)).
getTime
());
comment
.
put
(
Comment
.
COMMENT_TIME
,
((
Date
)
comment
.
get
(
Comment
.
COMMENT_DATE
)).
getTime
());
comment
.
put
(
Comment
.
COMMENT_NAME
,
comment
.
getString
(
Comment
.
COMMENT_NAME
));
comment
.
put
(
Comment
.
COMMENT_NAME
,
comment
.
getString
(
Comment
.
COMMENT_NAME
));
comment
.
put
(
Comment
.
COMMENT_URL
,
comment
.
getString
(
Comment
.
COMMENT_URL
));
comment
.
put
(
Comment
.
COMMENT_URL
,
comment
.
getString
(
Comment
.
COMMENT_URL
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment