Commit eb8c764a authored by Liang Ding's avatar Liang Ding

Merge branch '3.6.1-dev'

parents 4f7c377f 8afaea7e
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package org.b3log.solo.processor.console; package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.Keys; import org.b3log.latke.Keys;
import org.b3log.latke.Latkes; import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject; import org.b3log.latke.ioc.Inject;
...@@ -43,7 +42,7 @@ import org.json.JSONObject; ...@@ -43,7 +42,7 @@ import org.json.JSONObject;
* Plugin console request processing. * Plugin console request processing.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.11, Apr 19, 2019 * @version 1.0.0.12, Apr 22, 2019
* @since 0.4.0 * @since 0.4.0
*/ */
@RequestProcessor @RequestProcessor
...@@ -344,11 +343,6 @@ public class PageConsole { ...@@ -344,11 +343,6 @@ public class PageConsole {
for (int i = 0; i < pages.length(); i++) { for (int i = 0; i < pages.length(); i++) {
final JSONObject page = pages.getJSONObject(i); final JSONObject page = pages.getJSONObject(i);
final String permalink = page.optString(Page.PAGE_PERMALINK);
if (StringUtils.startsWith(permalink, "/")) {
page.put(Page.PAGE_PERMALINK, Latkes.getServePath() + permalink);
}
String title = page.optString(Page.PAGE_TITLE); String title = page.optString(Page.PAGE_TITLE);
title = StringEscapeUtils.escapeXml(title); title = StringEscapeUtils.escapeXml(title);
page.put(Page.PAGE_TITLE, title); page.put(Page.PAGE_TITLE, title);
......
...@@ -59,7 +59,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT; ...@@ -59,7 +59,7 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.7.0.9, Apr 8, 2019 * @version 1.7.0.10, Apr 22, 2019
* @since 0.3.1 * @since 0.3.1
*/ */
@Service @Service
...@@ -863,13 +863,6 @@ public class DataModelService { ...@@ -863,13 +863,6 @@ public class DataModelService {
try { try {
LOGGER.debug("Filling page navigations...."); LOGGER.debug("Filling page navigations....");
final List<JSONObject> pages = pageRepository.getPages(); final List<JSONObject> pages = pageRepository.getPages();
for (final JSONObject page : pages) {
final String permalink = page.optString(Page.PAGE_PERMALINK);
if (StringUtils.startsWith(permalink, "/")) {
page.put(Page.PAGE_PERMALINK, Latkes.getServePath() + permalink);
}
}
dataModel.put(Common.PAGE_NAVIGATIONS, pages); dataModel.put(Common.PAGE_NAVIGATIONS, pages);
} catch (final RepositoryException e) { } catch (final RepositoryException e) {
LOGGER.log(Level.ERROR, "Fills page navigations failed", e); LOGGER.log(Level.ERROR, "Fills page navigations failed", e);
......
...@@ -26,7 +26,6 @@ import org.b3log.latke.repository.Transaction; ...@@ -26,7 +26,6 @@ import org.b3log.latke.repository.Transaction;
import org.b3log.latke.service.LangPropsService; import org.b3log.latke.service.LangPropsService;
import org.b3log.latke.service.ServiceException; import org.b3log.latke.service.ServiceException;
import org.b3log.latke.service.annotation.Service; import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.Strings;
import org.b3log.solo.model.Page; import org.b3log.solo.model.Page;
import org.b3log.solo.repository.CommentRepository; import org.b3log.solo.repository.CommentRepository;
import org.b3log.solo.repository.PageRepository; import org.b3log.solo.repository.PageRepository;
...@@ -127,27 +126,7 @@ public class PageMgmtService { ...@@ -127,27 +126,7 @@ public class PageMgmtService {
final JSONObject oldPage = pageRepository.get(pageId); final JSONObject oldPage = pageRepository.get(pageId);
final JSONObject newPage = new JSONObject(page, JSONObject.getNames(page)); final JSONObject newPage = new JSONObject(page, JSONObject.getNames(page));
newPage.put(Page.PAGE_ORDER, oldPage.getInt(Page.PAGE_ORDER)); newPage.put(Page.PAGE_ORDER, oldPage.getInt(Page.PAGE_ORDER));
String permalink = page.optString(Page.PAGE_PERMALINK).trim(); final String permalink = page.optString(Page.PAGE_PERMALINK).trim();
final String oldPermalink = oldPage.getString(Page.PAGE_PERMALINK);
if (!oldPermalink.equals(permalink)) {
if (!Strings.isURL(permalink)) {
if (transaction.isActive()) {
transaction.rollback();
}
throw new ServiceException(langPropsService.get("invalidPermalinkFormatLabel"));
}
if (!oldPermalink.equals(permalink) && permalinkQueryService.exist(permalink)) {
if (transaction.isActive()) {
transaction.rollback();
}
throw new ServiceException(langPropsService.get("duplicatedPermalinkLabel"));
}
}
newPage.put(Page.PAGE_PERMALINK, permalink); newPage.put(Page.PAGE_PERMALINK, permalink);
page.put(Page.PAGE_ICON, page.optString(Page.PAGE_ICON)); page.put(Page.PAGE_ICON, page.optString(Page.PAGE_ICON));
...@@ -211,15 +190,7 @@ public class PageMgmtService { ...@@ -211,15 +190,7 @@ public class PageMgmtService {
final int maxOrder = pageRepository.getMaxOrder(); final int maxOrder = pageRepository.getMaxOrder();
page.put(Page.PAGE_ORDER, maxOrder + 1); page.put(Page.PAGE_ORDER, maxOrder + 1);
String permalink = page.optString(Page.PAGE_PERMALINK); final String permalink = page.optString(Page.PAGE_PERMALINK);
if (!Strings.isURL(permalink)) {
if (transaction.isActive()) {
transaction.rollback();
}
throw new ServiceException(langPropsService.get("invalidPermalinkFormatLabel"));
}
if (permalinkQueryService.exist(permalink)) { if (permalinkQueryService.exist(permalink)) {
if (transaction.isActive()) { if (transaction.isActive()) {
transaction.rollback(); transaction.rollback();
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
* @description index for admin * @description index for admin
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.3.0.0, Mar 30, 2019 * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.0.0, Apr 22, 2019
*/ */
Util.htmlDecode = function (code) { Util.htmlDecode = function (code) {
...@@ -28,18 +29,6 @@ Util.htmlDecode = function (code) { ...@@ -28,18 +29,6 @@ Util.htmlDecode = function (code) {
return div.innerText return div.innerText
} }
/**
* @description URL 没有协议头,则自动加上 http://
* @param {String} url URL 地址
* @returns {String} 添加后的URL
*/
Util.proessURL = function (url) {
if (!/^\w+:\/\//.test(url)) {
url = 'http://' + url
}
return url
}
var Admin = function () { var Admin = function () {
this.register = {} this.register = {}
// 工具栏下的工具 // 工具栏下的工具
......
This diff is collapsed.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.0.0, Feb 6, 2019 * @version 1.3.0.1, Apr 22, 2019
*/ */
/* page-list 相关操作 */ /* page-list 相关操作 */
...@@ -202,7 +202,7 @@ admin.pageList = { ...@@ -202,7 +202,7 @@ admin.pageList = {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
var pagePermalink = Util.proessURL($("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g, "")); var pagePermalink = $("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g, "");
var requestJSONObject = { var requestJSONObject = {
"page": { "page": {
...@@ -255,8 +255,7 @@ admin.pageList = { ...@@ -255,8 +255,7 @@ admin.pageList = {
$("#loadMsg").text(Label.loadingLabel); $("#loadMsg").text(Label.loadingLabel);
$("#tipMsg").text(""); $("#tipMsg").text("");
var pagePermalink = Util.proessURL($("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g, "")); var pagePermalink = $("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g, "");
var requestJSONObject = { var requestJSONObject = {
"page": { "page": {
......
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