📄 configurationwebhandler.java
字号:
FileOutputStream fos = new FileOutputStream(tempFilename);
fos.write(tempFilename.getBytes());
fos.close();
tempFile.delete();
} catch (IOException ex) {
String errorMessage = "Check your mvnforum_log. Detail : " + ex.getMessage();
throw new BadInputException(errorMessage);
}
MyUtil.checkClassName(locale, member_implementation, true);
MyUtil.checkClassName(locale, onlineuser_implementation, true);
MyUtil.checkClassName(locale, authenticator_implementation, false);
MyUtil.checkClassName(locale, requestprocessor_implementation, true);
MyUtil.checkClassName(locale, lucene_analyzer_implementation, true);
MyUtil.checkClassName(locale, binarystorage_implementation, true);
// End checking, now save the value
String strPathName = FileUtil.getServletClassesPath();
SAXReader reader = new SAXReader();
Document document = reader.read(new File(strPathName + "mvnforum.xml"));
Element root = document.getRootElement();
// iterate through child elements of root
for (Iterator i = root.elementIterator(); i.hasNext(); ) {
Element element = (Element) i.next();
for (int j = 0, size = element.nodeCount(); j < size; j++) {
Node node = element.node(j);
if (node.getNodeTypeName().equals("Element")) {
if (node.getName().equals("mvnforum_home")) {
node.setText(mvnforum_home);
} else if (node.getName().equals("mvnforum_log")) {
node.setText(mvnforum_log);
} else if (node.getName().equals("webmaster_email")) {
node.setText(webmaster_email);
} else if (node.getName().equals("logo_url")) {
node.setText(logo_url);
} else if (node.getName().equals("redirect_login_url")) {
node.setText(redirect_login_url);
} else if (node.getName().equals("supported_locales")) {
node.setText(supported_locales);
} else if (node.getName().equals("default_locale_name")) {
node.setText(default_locale_name);
} else if (node.getName().equals("locale_parameter_name")) {
node.setText(locale_parameter_name);
} else if (node.getName().equals("default_guest_name")) {
node.setText(default_guest_name);
} else if (node.getName().equals("default_guest_timezone")) {
node.setText(String.valueOf(default_guest_timezone));
} else if (node.getName().equals("enable_portlet")) {
node.setText(enable_portlet);
} else if (node.getName().equals("enable_cache_member")) {
node.setText(enable_cache_member);
} else if (node.getName().equals("enable_cache_post")) {
node.setText(enable_cache_post);
} else if (node.getName().equals("enable_cache_thread")) {
node.setText(enable_cache_thread);
} else if (node.getName().equals("enable_cache_forum")) {
node.setText(enable_cache_forum);
} else if (node.getName().equals("enable_cache_category")) {
node.setText(enable_cache_category);
} else if (node.getName().equals("enable_passwordless_auth")) {
node.setText(enable_passwordless_auth);
} else if (node.getName().equals("enable_login_info_in_cookie")) {
node.setText(enable_login_info_in_cookie);
} else if (node.getName().equals("enable_login_info_in_session")) {
node.setText(enable_login_info_in_session);
} else if (node.getName().equals("enable_login_info_in_realm")) {
node.setText(enable_login_info_in_realm);
} else if (node.getName().equals("enable_login_info_in_customization")) {
node.setText(enable_login_info_in_customization);
} else if (node.getName().equals("require_activation")) {
node.setText(require_activation);
} else if (node.getName().equals("enable_login")) {
node.setText(enable_login);
} else if (node.getName().equals("enable_new_member")) {
node.setText(enable_new_member);
} else if (node.getName().equals("enable_new_post")) {
node.setText(enable_new_post);
} else if (node.getName().equals("enable_rss")) {
node.setText(enable_rss);
} else if (node.getName().equals("enable_watch")) {
node.setText(enable_watch);
} else if (node.getName().equals("enable_attachment")) {
node.setText(enable_attachment);
} else if (node.getName().equals("enable_avatar")) {
node.setText(enable_avatar);
} else if (node.getName().equals("enable_emoticon")) {
node.setText(enable_emoticon);
} else if (node.getName().equals("enable_captcha")) {
node.setText(enable_captcha);
} else if (node.getName().equals("enable_portal_like_index_page")) {
node.setText(enable_portal_like_index_page);
} else if (node.getName().equals("enable_search")) {
node.setText(enable_search);
} else if (node.getName().equals("enable_online_users")) {
node.setText(enable_online_users);
} else if (node.getName().equals("enable_duplicate_onlineusers")) {
node.setText(enable_duplicate_onlineusers);
} else if (node.getName().equals("enable_invisible_users")) {
node.setText(enable_invisible_users);
} else if (node.getName().equals("enable_listmembers")) {
node.setText(enable_listmembers);
} else if (node.getName().equals("enable_show_last_login")) {
node.setText(enable_show_last_login);
} else if (node.getName().equals("enable_private_message")) {
node.setText(enable_private_message);
} else if (node.getName().equals("enable_public_message")) {
node.setText(enable_public_message);
} else if (node.getName().equals("enable_message_attachment")) {
node.setText(enable_message_attachment);
} else if (node.getName().equals("enable_most_active_threads")) {
node.setText(enable_most_active_threads);
} else if (node.getName().equals("enable_most_active_members")) {
node.setText(enable_most_active_members);
} else if (node.getName().equals("enable_site_statistics_overview")) {
node.setText(enable_site_statistics_overview);
} else if (node.getName().equals("enable_admin_can_change_password")) {
node.setText(enable_admin_can_change_password);
} else if (node.getName().equals("enable_guest_view_image_attachment")) {
node.setText(enable_guest_view_image_attachment);
} else if (node.getName().equals("default_watch_option")) {
node.setText(String.valueOf(default_watch_option));
} else if (node.getName().equals("default_moderation_option")) {
node.setText(String.valueOf(default_moderation_option));
// children of mvnforumfactoryconfig
} else if (node.getName().equals("member_implementation")) {
node.setText(member_implementation);
} else if (node.getName().equals("onlineuser_implementation")) {
node.setText(onlineuser_implementation);
} else if (node.getName().equals("authenticator_implementation")) {
node.setText(authenticator_implementation);
} else if (node.getName().equals("requestprocessor_implementation")) {
node.setText(requestprocessor_implementation);
} else if (node.getName().equals("lucene_analyzer_implementation")) {
node.setText(lucene_analyzer_implementation);
} else if (node.getName().equals("binarystorage_implementation")) {
node.setText(binarystorage_implementation);
}
}
}
}
saveDocument(document, strPathName + "mvnforum.xml");
request.setAttribute("step", "1");
}
public void updateConfigStepTwo(GenericRequest request)
throws BadInputException, DocumentException, IOException,
AssertionException, DatabaseException, AuthenticationException {
OnlineUser onlineUser = onlineUserManager.getOnlineUser(request);
MVNForumPermission permission = onlineUser.getPermission();
permission.ensureCanAdminSystem();
int max_private_message = GenericParamUtil.getParameterUnsignedInt(request, "max_private_message");
String max_message_attachment_size = GenericParamUtil.getParameterSafe(request, "max_message_attachment_size", true);
String max_attachment_size = GenericParamUtil.getParameterSafe(request, "max_attachment_size", true);
int max_favorite_thread = GenericParamUtil.getParameterUnsignedInt(request, "max_favorite_thread");
int max_edit_days = GenericParamUtil.getParameterUnsignedInt(request, "max_edit_days");
int max_attach_days = GenericParamUtil.getParameterUnsignedInt(request, "max_attach_days");
int max_delete_days = GenericParamUtil.getParameterUnsignedInt(request, "max_delete_days");
int rows_per_page = GenericParamUtil.getParameterUnsignedInt(request, "rows_per_page");
int rows_per_rss = GenericParamUtil.getParameterUnsignedInt(request, "rows_per_rss");
int hot_topic_threshold = GenericParamUtil.getParameterUnsignedInt(request, "hot_topic_threshold");
int max_posts_per_hour = GenericParamUtil.getParameterUnsignedInt(request, "max_posts_per_hour");
int max_members_per_hour = GenericParamUtil.getParameterUnsignedInt(request, "max_members_per_hour");
int max_logins_per_hour = GenericParamUtil.getParameterUnsignedInt(request, "max_logins_per_hour");
int max_messages_per_hour = GenericParamUtil.getParameterUnsignedInt(request, "max_messages_per_hour");
int max_chars_in_short_summary = GenericParamUtil.getParameterUnsignedInt(request, "max_chars_in_short_summary");
int max_chars_in_long_summary = GenericParamUtil.getParameterUnsignedInt(request, "max_chars_in_long_summary");
int max_chars_in_rss = GenericParamUtil.getParameterUnsignedInt(request, "max_chars_in_rss");
String enable_backup_on_server = GenericParamUtil.getParameterSafe(request, "enable_backup_on_server", true);
String max_import_size = GenericParamUtil.getParameterSafe(request, "max_import_size", true);
String strPathName = FileUtil.getServletClassesPath();
SAXReader reader = new SAXReader();
Document document = reader.read(new File(strPathName + "mvnforum.xml"));
Element root = document.getRootElement();
// iterate through child elements of root
for (Iterator i = root.elementIterator("mvnforumconfig"); i.hasNext(); ) {
Element element = (Element) i.next();
for (int j = 0, size = element.nodeCount(); j < size; j++) {
Node node = element.node(j);
if (node.getNodeTypeName().equals("Element")) {
if (node.getName().equals("max_private_message")) {
node.setText(String.valueOf(max_private_message));
} else if (node.getName().equals("max_message_attachment_size")) {
node.setText(max_message_attachment_size);
} else if (node.getName().equals("max_attachment_size")) {
node.setText(max_attachment_size);
} else if (node.getName().equals("max_favorite_thread")) {
node.setText(String.valueOf(max_favorite_thread));
} else if (node.getName().equals("max_edit_days")) {
node.setText(String.valueOf(max_edit_days));
} else if (node.getName().equals("max_attach_days")) {
node.setText(String.valueOf(max_attach_days));
} else if (node.getName().equals("max_delete_days")) {
node.setText(String.valueOf(max_delete_days));
} else if (node.getName().equals("rows_per_page")) {
node.setText(String.valueOf(rows_per_page));
} else if (node.getName().equals("rows_per_rss")) {
node.setText(String.valueOf(rows_per_rss));
} else if (node.getName().equals("hot_topic_threshold")) {
node.setText(String.valueOf(hot_topic_threshold));
} else if (node.getName().equals("max_posts_per_hour")) {
node.setText(String.valueOf(max_posts_per_hour));
} else if (node.getName().equals("max_members_per_hour")) {
node.setText(String.valueOf(max_members_per_hour));
} else if (node.getName().equals("max_logins_per_hour")) {
node.setText(String.valueOf(max_logins_per_hour));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -