PluginProbe
wpForo Forum / 3.1.2
wpForo Forum v3.1.2
3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 All 137 releases
wpforo / includes / options-migration.php

options-migration.php in wpForo Forum 3.1.2, at includes/options-migration.php

648 lines 34.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function _wpforo_emails_old_shortcodes_to_new( $txt ){
4 return str_replace(
5 ['[reply_title]', '[reply_desc]', '[topic_desc]', '[author-user-name]', '[post_author_name]', '[member_name]', '[mentioned-user-name]', '[topic-title]', '[post-url]', '[post-desc]', '[post_desc]', '[forum]', '[topic]', '[post]', '[reply]'],
6 ['[post_title]', '[post_body]', '[topic_body]', '[owner_display_name]', '[owner_display_name]', '[user_display_name]', '[user_display_name]', '[topic_title]', '[post_url]', '[post_body]', '[post_body]', '[forum_link]', '[topic_link]', '[post_link]', '[post_link]'],
7 $txt
8 );
9 }
10
11 function _wpforo_migrate_old_options_to_new() {
12 $blogname = get_option( 'blogname', '' );
13 $adminemail = get_option( 'admin_email', '' );
14 $upload_max_filesize = @ini_get( 'upload_max_filesize' );
15 $upload_max_filesize = wpforo_human_size_to_bytes( $upload_max_filesize );
16 if( ! $upload_max_filesize || $upload_max_filesize > 10485760 ) $upload_max_filesize = 10485760;
17
18 $_general = wpforo_get_option( 'wpforo_general_options', [
19 'title' => $blogname . ' ' . __( 'Forum', 'wpforo' ),
20 'description' => $blogname . ' ' . __( 'Discussion Board', 'wpforo' ),
21 'lang' => 1
22 ], false );
23 $_features = wpforo_get_option( 'wpforo_features', [
24 'user-admin-bar' => 0,
25 'page-title' => 1,
26 'top-bar' => 1,
27 'top-bar-search' => 1,
28 'breadcrumb' => 1,
29 'footer-stat' => 1,
30 'notifications' => 1,
31 'notifications-live' => 0,
32 'notifications-bar' => 1,
33 'mention-nicknames' => 1,
34 'content-do_shortcode' => 0,
35 'view-logging' => 1,
36 'track-logging' => 1,
37 'goto-unread' => 1,
38 'goto-unread-button' => 0,
39 'profile' => 1,
40 'user-register' => 1,
41 'user-register-email-confirm' => 1,
42 'disable_new_user_admin_notification' => 1,
43 'register-url' => 0,
44 'login-url' => 0,
45 'resetpass-url' => 1,
46 'replace-avatar' => 1,
47 'avatars' => 1,
48 'custom-avatars' => 1,
49 'signature' => 1,
50 'rating' => 1,
51 'rating_title' => 1,
52 'member_cashe' => 1,
53 'object_cashe' => 1,
54 'option_cache' => 1,
55 'html_cashe' => 0,
56 'memory_cashe' => 1,
57 'seo-title' => 1,
58 'seo-meta' => 1,
59 'seo-profile' => 1,
60 'rss-feed' => 1,
61 'font-awesome' => 1,
62 'bp_activity' => 1,
63 'bp_notification' => 1,
64 'bp_forum_tab' => 1,
65 'um_forum_tab' => 1,
66 'um_notification' => 1,
67 'user-synch' => 0,
68 'role-synch' => 1,
69 'output-buffer' => 1,
70 'wp-date-format' => 0,
71 'subscribe_conf' => 1,
72 'subscribe_checkbox_on_post_editor' => 1,
73 'subscribe_checkbox_default_status' => 0,
74 'attach-media-lib' => 1,
75 'admin-cp' => 1,
76 'debug-mode' => 0,
77 'copyright' => 1,
78 ], false );
79 $_members = wpforo_get_option( 'wpforo_member_options', [
80 'custom_title_is_on' => 1,
81 'default_title' => 'Member',
82 'members_per_page' => 15,
83 'online_status_timeout' => 240,
84 'url_structure' => 'nicename',
85 'search_type' => 'search', // can to be 'search' or 'filter'
86 'login_url' => '',
87 'register_url' => '',
88 'lost_password_url' => '',
89 'redirect_url_after_login' => '',
90 'redirect_url_after_register' => '',
91 'redirect_url_after_confirm_sbscrb' => '',
92 'rating_title_ug' => [ 3, 4, 5 ],
93 'rating_badge_ug' => [ 1, 2, 3, 4, 5 ],
94 'title_usergroup' => [ 1, 2, 4, 5 ],
95 'title_second_usergroup' => [ 3 ],
96 ], false );
97 $_subscribes = wpforo_get_option( 'wpforo_subscribe_options', [
98 'from_name' => $blogname . ' - ' . __( 'Forum', 'wpforo' ),
99 'from_email' => $adminemail,
100 'admin_emails' => $adminemail,
101 'new_topic_notify' => 1,
102 'new_reply_notify' => 0,
103 'confirmation_email_subject' => __( "Please confirm subscription to [entry_title]", 'wpforo' ),
104 'confirmation_email_message' => __( "Hello [member_name]!<br>\n Thank you for subscribing.<br>\n This is an automated response.<br>\n We are glad to inform you that after confirmation you will get updates from - [entry_title].<br>\n Please click on link below to complete this step.<br>\n [confirm_link]", 'wpforo' ),
105 'new_topic_notification_email_subject' => __( "New Topic", 'wpforo' ),
106 'new_topic_notification_email_message' => __( "Hello [member_name]!<br>\n New topic has been created on your subscribed forum - [forum].\n <br><br>\n <strong>[topic_title]</strong>\n <blockquote>\n [topic_desc]\n </blockquote>\n <br><hr>\n If you want to unsubscribe from this forum please use the link below.<br>\n [unsubscribe_link]", 'wpforo' ),
107 'new_post_notification_email_subject' => __( "New Reply", 'wpforo' ),
108 'new_post_notification_email_message' => __( "Hello [member_name]!<br>\n New reply has been posted on your subscribed topic - [topic].\n <br><br>\n <strong>[reply_title]</strong>\n <blockquote >\n [reply_desc]\n </blockquote>\n <br><hr>\n If you want to unsubscribe from this topic please use the link below.<br>\n [unsubscribe_link]", 'wpforo' ),
109 'user_post_notification_email_subject' => __( "New Post from [post_author_name]", 'wpforo' ),
110 'user_post_notification_email_message' => __( "Hello [member_name]!<br>\n New topic or post has been created by [post_author_name] you are following.\n <br><br>\n <strong>[post_title]</strong>\n <blockquote >\n [post_desc]\n </blockquote>\n <br><hr>\n If you want to unfollow this user please use the link below.<br>\n [unsubscribe_link]", 'wpforo' ),
111 'report_email_subject' => __( "Forum Post Report", 'wpforo' ),
112 'report_email_message' => __( "<strong>Report details:</strong>\n Reporter: [reporter], <br>\n Message: [message],<br>\n <br>\n [post_url]", 'wpforo' ),
113 'overwrite_new_user_notification_admin' => 1,
114 'wp_new_user_notification_email_admin_subject' => __( "[blogname] New User Registration", 'wpforo' ),
115 'wp_new_user_notification_email_admin_message' => __( "New user registration on your site [blogname]:\n\nUsername: [user_login]\n\nEmail: [user_email]\n", 'wpforo' ),
116 'overwrite_new_user_notification' => 1,
117 'wp_new_user_notification_email_subject' => __( "[blogname] Your username and password info", 'wpforo' ),
118 'wp_new_user_notification_email_message' => __( "Username: [user_login]\n\nTo set your password, visit the following address:\n\n[set_password_url]\n\n", 'wpforo' ),
119 'overwrite_reset_password_email_message' => 1,
120 'reset_password_email_message' => __( "Hello! \n\n You asked us to reset your password for your account using the email address [user_login]. \n\n If this was a mistake, or you didn't ask for a password reset, just ignore this email and nothing will happen. \n\n To reset your password, visit the following address: \n\n [reset_password_url] \n\n Thanks!", 'wpforo' ),
121 'user_mention_notify' => 1,
122 'user_mention_email_subject' => __( "You have been mentioned in forum post", 'wpforo' ),
123 'user_mention_email_message' => __( "Hi [mentioned-user-name]! <br>\n\n You have been mentioned in a post on \"[topic-title]\" by [author-user-name].<br/><br/>\n\n Post URL: [post-url]", 'wpforo' ),
124 ], false );
125 $_tools_antispam = wpforo_get_option( 'wpforo_tools_antispam', [
126 'spam_filter' => 1,
127 'spam_filter_level_topic' => mt_rand( 30, 60 ),
128 'spam_filter_level_post' => mt_rand( 30, 60 ),
129 'spam_user_ban' => 0,
130 'new_user_max_posts' => 3,
131 'unapprove_post_if_user_is_new' => 0,
132 'spam_user_ban_notification' => 1,
133 'min_number_post_to_attach' => 0,
134 'min_number_post_to_link' => 0,
135 'spam_file_scanner' => 0,
136 'limited_file_ext' => 'pdf|doc|docx|txt|htm|html|rtf|xml|xls|xlsx|zip|rar|tar|gz|bzip|7z',
137 'exclude_file_ext' => 'pdf|doc|docx|txt',
138 'rc_site_key' => '',
139 'rc_secret_key' => '',
140 'rc_theme' => 'light',
141 'rc_login_form' => 0,
142 'rc_reg_form' => 0,
143 'rc_lostpass_form' => 0,
144 'rc_wpf_login_form' => 1,
145 'rc_wpf_reg_form' => 1,
146 'rc_wpf_lostpass_form' => 1,
147 'rc_topic_editor' => 1,
148 'rc_post_editor' => 1,
149 'html' => 'embed(src width height name pluginspage type wmode allowFullScreen allowScriptAccess flashVars),',
150 ], false );
151 $_forums = wpforo_get_option( 'wpforo_forum_options', [
152 'layout_extended_intro_topics_toggle' => 1,
153 'layout_extended_intro_topics_count' => 5,
154 'layout_extended_intro_topics_length' => 45,
155 'layout_qa_intro_topics_toggle' => 1,
156 'layout_qa_intro_topics_count' => 3,
157 'layout_qa_intro_topics_length' => 90,
158 'layout_threaded_intro_topics_toggle' => 0,
159 'layout_threaded_display_subforums' => 1,
160 'layout_threaded_intro_topics_count' => 10,
161 'layout_threaded_intro_topics_length' => 0,
162 'layout_threaded_filter_buttons' => 1,
163 'layout_threaded_add_topic_button' => 1,
164 'display_current_viewers' => 1,
165 ], false );
166 $_posts = wpforo_get_option( 'wpforo_post_options', [
167 'layout_extended_intro_posts_toggle' => 1,
168 'layout_extended_intro_posts_count' => 4,
169 'layout_extended_intro_posts_length' => 50,
170 'recent_posts_type' => 'topics',
171 'tags' => 1,
172 'max_tags' => 5,
173 'tags_per_page' => 100,
174 'topics_per_page' => 10,
175 'edit_topic' => 1,
176 'edit_post' => 1,
177 'eot_durr' => 300,
178 'dot_durr' => 300,
179 'posts_per_page' => 15,
180 'layout_threaded_posts_per_page' => 5,
181 'layout_qa_posts_per_page' => 15,
182 'layout_qa_comments_limit_count' => 3,
183 'layout_qa_first_post_reply' => 1,
184 'layout_threaded_nesting_level' => 5,
185 'layout_threaded_first_post_reply' => 0,
186 'eor_durr' => 300,
187 'dor_durr' => 300,
188 'max_upload_size' => $upload_max_filesize,
189 'display_current_viewers' => 1,
190 'display_recent_viewers' => 1,
191 'display_admin_viewers' => 1,
192 'union_first_post' => [
193 1 => 0,
194 2 => 0,
195 3 => 1,
196 4 => 0,
197 ],
198 'search_max_results' => 100,
199 'topic_title_min_length' => 1,
200 'topic_title_max_length' => 0,
201 'topic_body_min_length' => 2,
202 'topic_body_max_length' => 0,
203 'post_body_min_length' => 2,
204 'post_body_max_length' => 0,
205 'comment_body_min_length' => 2,
206 'comment_body_max_length' => 0,
207 'toolbar_location_topic' => 'top',
208 'toolbar_location_reply' => 'top',
209 ], false );
210 if( ! $_posts['max_upload_size'] || $_posts['max_upload_size'] > 10485760 ) $_posts['max_upload_size'] = 10485760;
211 $_forms = wpforo_get_option( 'wpforo_form_options', [
212 'qa_comments_rich_editor' => 0,
213 'threaded_reply_rich_editor' => 1,
214 'qa_display_answer_editor' => 1,
215 ], false );
216 $_activity = wpforo_get_option( 'wpforo_activity_options', [
217 'edit_topic' => 1,
218 'edit_post' => 1,
219 'edit_log_display_limit' => 0,
220 ], false );
221 $_revisions = wpforo_get_option( 'wpforo_revision_options', [
222 'auto_draft_interval' => 30000,
223 'max_drafts_per_page' => 3,
224 'is_preview_on' => 1,
225 'is_draft_on' => 1,
226 ], false );
227 $_styles = wpforo_get_option( 'wpforo_style_options', [
228 'font_size_forum' => 17,
229 'font_size_topic' => 16,
230 'font_size_post_content' => 14,
231 'custom_css' => "#wpforo-wrap {\r\n font-size: 13px; width: 100%; padding:10px 0; margin:0px;\r\n}\r\n",
232 ], false );
233 $_theme = wpforo_get_option( 'wpforo_theme_options', [ 'style' => 'default' ], false );
234 $_seo = wpforo_get_option( 'wpforo_seo_options', [
235 'members_sitemap' => 1,
236 'forums_sitemap' => 1,
237 'topics_sitemap' => 1,
238 'sitemap_items_per_page' => 1000,
239 'allow_ping' => 1,
240 'ping_immediately' => 0,
241 ], false );
242 $_tools_misc = wpforo_get_option( 'wpforo_tools_misc', [
243 'dofollow' => '',
244 'noindex' => '',
245 'admin_note' => '',
246 'admin_note_groups' => [ 1, 2, 3, 4, 5 ],
247 'admin_note_pages' => [ 'forum' ],
248 ], false );
249 $_api = wpforo_get_option( 'wpforo_api_options', [
250 'fb_api_id' => '',
251 'fb_api_secret' => '',
252 'fb_login' => 0,
253 'fb_load_sdk' => 1,
254 'fb_sdk_version' => 'v2.10',
255 'fb_lb_on_lp' => 1,
256 'fb_lb_on_rp' => 1,
257 'fb_redirect' => 'profile',
258 'fb_redirect_url' => '',
259 'tw_load_wjs' => 1,
260 'gg_load_js' => 0,
261 'vk_load_js' => 1,
262 'ok_load_js' => 1,
263 'sb_on' => 1,
264 'sb_toggle_on' => 0,
265 'sb' => [ 'fb' => 1, 'tw' => 1, 'wapp' => 1, 'lin' => 0, 'vk' => 0, 'ok' => 0, 'gg' => 0 ],
266 'sb_icon' => 'mixed',
267 'sb_type' => 'icon',
268 'sb_style' => 'grey',
269 'sb_toggle' => 4,
270 'sb_location_toggle' => 'top',
271 'sb_toggle_type' => 'collapsed',
272 'sb_location' => [ 'top' => 0, 'bottom' => 1 ],
273 ], false );
274
275 $_tools_legal = wpforo_get_option( 'wpforo_tools_legal', [
276 'rules_checkbox' => 0,
277 'rules_text' => null,
278 'page_terms' => '',
279 'page_privacy' => '',
280 'forum_privacy_text' => null,
281 'checkbox_terms_privacy' => 0,
282 'checkbox_email_password' => 1,
283 'checkbox_forum_privacy' => 0,
284 'checkbox_fb_login' => 1,
285 'contact_page_url' => null,
286 'cookies' => 1,
287 ]);
288
289
290 /**
291 * #### -- new settings array -- ####
292 */
293 $general = [
294 'admin_bar' => $_features['user-admin-bar'] ? array_map( 'intval', (array) WPF()->usergroup->get_usergroups( 'groupid' ) ) : [],
295 'wp_date_format' => $_features['wp-date-format'],
296 'debug_mode' => $_features['debug-mode'],
297 'fontawesome' => ( $_features['font-awesome'] == 1 ? 'forum' : ( $_features['font-awesome'] == 2 ? 'sitewide' : 'off' ) ),
298 ];
299
300 $members = [
301 'list_order' => 'posts',
302 'hide_inactive' => true,
303 'members_per_page' => $_members['members_per_page'],
304 'search_type' => $_members['search_type'],
305 ];
306
307 $profiles = [
308 'profile' => ( $_features['profile'] == 2 ? 'wpforo' : ( $_features['profile'] == 3 ? 'bp' : ( $_features['profile'] == 4 ? 'um' : 'default' ) ) ),
309 'url_structure' => $_members['url_structure'],
310 'online_status_timeout' => $_members['online_status_timeout'],
311 'custom_title_is_on' => $_members['custom_title_is_on'],
312 'default_title' => $_members['default_title'],
313 'title_groupids' => $_members['title_usergroup'],
314 'title_secondary_groupids' => $_members['title_second_usergroup'],
315 'mention_nicknames' => $_features['mention-nicknames'],
316 'avatars' => $_features['avatars'],
317 'custom_avatars' => $_features['custom-avatars'],
318 'replace_avatar' => $_features['replace-avatar'],
319 'signature' => $_features['signature'],
320 ];
321
322 $rating = [
323 'rating' => $_features['rating'],
324 'rating_title' => $_features['rating_title'],
325 'topic_points' => 2,
326 'post_points' => 1,
327 'like_points' => 0.5,
328 'dislike_points' => - 0.5,
329 'rating_title_ug' => $_members['rating_title_ug'],
330 'rating_badge_ug' => $_members['rating_badge_ug'],
331 ];
332
333 $authorization = [
334 'user_register' => $_features['user-register'],
335 'user_register_email_confirm' => $_features['user-register-email-confirm'],
336 'role_synch' => $_features['role-synch'],
337 'use_our_register_url' => $_features['register-url'],
338 'use_our_login_url' => $_features['login-url'],
339 'use_our_lostpassword_url' => $_features['resetpass-url'],
340 'login_url' => $_members['login_url'],
341 'register_url' => $_members['register_url'],
342 'lost_password_url' => $_members['lost_password_url'],
343 'redirect_url_after_login' => $_members['redirect_url_after_login'],
344 'redirect_url_after_register' => $_members['redirect_url_after_register'],
345 'redirect_url_after_confirm_sbscrb' => $_members['redirect_url_after_confirm_sbscrb'],
346 'fb_api_id' => $_api['fb_api_id'],
347 'fb_api_secret' => $_api['fb_api_secret'],
348 'fb_login' => $_api['fb_login'],
349 'fb_lb_on_lp' => $_api['fb_lb_on_lp'],
350 'fb_lb_on_rp' => $_api['fb_lb_on_rp'],
351 'fb_redirect' => $_api['fb_redirect'],
352 'fb_redirect_url' => $_api['fb_redirect_url'],
353 ];
354
355 $recaptcha = [
356 'site_key' => $_tools_antispam['rc_site_key'],
357 'secret_key' => $_tools_antispam['rc_secret_key'],
358 'theme' => $_tools_antispam['rc_theme'],
359 'topic_editor' => $_tools_antispam['rc_topic_editor'],
360 'post_editor' => $_tools_antispam['rc_post_editor'],
361 'wpf_login_form' => $_tools_antispam['rc_wpf_login_form'],
362 'wpf_reg_form' => $_tools_antispam['rc_wpf_reg_form'],
363 'wpf_lostpass_form' => $_tools_antispam['rc_wpf_lostpass_form'],
364 'login_form' => $_tools_antispam['rc_login_form'],
365 'reg_form' => $_tools_antispam['rc_reg_form'],
366 'lostpass_form' => $_tools_antispam['rc_lostpass_form'],
367 ];
368
369 $buddypress = [
370 'activity' => $_features['bp_activity'],
371 'notification' => $_features['bp_notification'],
372 'forum_tab' => $_features['bp_forum_tab'],
373 ];
374
375 $um = [
376 'notification' => $_features['um_notification'],
377 'forum_tab' => $_features['um_forum_tab'],
378 ];
379
380 $forums = [
381 'layout_extended_intro_topics_toggle' => $_forums['layout_extended_intro_topics_toggle'],
382 'layout_extended_intro_topics_count' => $_forums['layout_extended_intro_topics_count'],
383 'layout_extended_intro_topics_length' => $_forums['layout_extended_intro_topics_length'],
384 'layout_qa_intro_topics_toggle' => $_forums['layout_qa_intro_topics_toggle'],
385 'layout_qa_intro_topics_count' => $_forums['layout_qa_intro_topics_count'],
386 'layout_qa_intro_topics_length' => $_forums['layout_qa_intro_topics_length'],
387 'layout_threaded_intro_topics_toggle' => $_forums['layout_threaded_intro_topics_toggle'],
388 'layout_threaded_display_subforums' => $_forums['layout_threaded_display_subforums'],
389 'layout_threaded_filter_buttons' => $_forums['layout_threaded_filter_buttons'],
390 'layout_threaded_add_topic_button' => $_forums['layout_threaded_add_topic_button'],
391 'layout_threaded_intro_topics_count' => $_forums['layout_threaded_intro_topics_count'],
392 'layout_threaded_intro_topics_length' => $_forums['layout_threaded_intro_topics_length'],
393 ];
394
395 $topics = [
396 'layout_extended_intro_posts_toggle' => $_posts['layout_extended_intro_posts_toggle'],
397 'layout_extended_intro_posts_count' => $_posts['layout_extended_intro_posts_count'],
398 'layout_extended_intro_posts_length' => $_posts['layout_extended_intro_posts_length'],
399 'layout_qa_posts_per_page' => $_posts['layout_qa_posts_per_page'],
400 'layout_qa_comments_limit_count' => $_posts['layout_qa_comments_limit_count'],
401 'layout_qa_first_post_reply' => $_posts['layout_qa_first_post_reply'],
402 'layout_threaded_posts_per_page' => $_posts['layout_threaded_posts_per_page'],
403 'layout_threaded_nesting_level' => $_posts['layout_threaded_nesting_level'],
404 'layout_threaded_first_post_reply' => $_posts['layout_threaded_first_post_reply'],
405 'topics_per_page' => $_posts['topics_per_page'],
406 'posts_per_page' => $_posts['posts_per_page'],
407 'search_max_results' => $_posts['search_max_results'],
408 'union_first_post' => $_posts['union_first_post'],
409 'recent_posts_type' => $_posts['recent_posts_type'],
410 ];
411
412 $posting = [
413 'qa_display_answer_editor' => $_forms['qa_display_answer_editor'],
414 'qa_comments_rich_editor' => $_forms['qa_comments_rich_editor'],
415 'threaded_reply_rich_editor' => $_forms['threaded_reply_rich_editor'],
416 'topic_title_min_length' => $_posts['topic_title_min_length'],
417 'topic_title_max_length' => $_posts['topic_title_max_length'],
418 'topic_body_min_length' => $_posts['topic_body_min_length'],
419 'topic_body_max_length' => $_posts['topic_body_max_length'],
420 'post_body_min_length' => $_posts['post_body_min_length'],
421 'post_body_max_length' => $_posts['post_body_max_length'],
422 'comment_body_min_length' => $_posts['comment_body_min_length'],
423 'comment_body_max_length' => $_posts['comment_body_max_length'],
424 'edit_own_topic_durr' => $_posts['eot_durr'],
425 'delete_own_topic_durr' => $_posts['dot_durr'],
426 'edit_own_post_durr' => $_posts['eor_durr'],
427 'delete_own_post_durr' => $_posts['dor_durr'],
428 'edit_topic' => $_posts['edit_topic'],
429 'edit_post' => $_posts['edit_post'],
430 'edit_log_display_limit' => $_activity['edit_log_display_limit'],
431 'is_preview_on' => $_revisions['is_preview_on'],
432 'is_draft_on' => $_revisions['is_draft_on'],
433 'auto_draft_interval' => $_revisions['auto_draft_interval'],
434 'max_drafts_per_page' => $_revisions['max_drafts_per_page'],
435 'max_upload_size' => $_posts['max_upload_size'],
436 'attachs_to_medialib' => $_features['attach-media-lib'],
437 'topic_editor_toolbar_location' => $_posts['toolbar_location_topic'],
438 'reply_editor_toolbar_location' => $_posts['toolbar_location_reply'],
439 'content_do_shortcode' => $_features['content-do_shortcode'],
440 'extra_html_tags' => $_tools_antispam['html'],
441 ];
442
443 $components = [
444 'admin_cp' => $_features['admin-cp'],
445 'page_title' => $_features['page-title'],
446 'top_bar' => $_features['top-bar'],
447 'top_bar_search' => $_features['top-bar-search'],
448 'breadcrumb' => $_features['breadcrumb'],
449 'footer' => true,
450 'footer_stat' => $_features['footer-stat'],
451 'copyright' => $_features['copyright'],
452 ];
453
454 $styles = [
455 'font_size_forum' => $_styles['font_size_forum'],
456 'font_size_topic' => $_styles['font_size_topic'],
457 'font_size_post_content' => $_styles['font_size_post_content'],
458 'custom_css' => $_styles['custom_css'],
459 'style' => $_theme['style'],
460 ];
461
462 $tags = [
463 'max_per_topic' => $_posts['max_tags'],
464 'per_page' => $_posts['tags_per_page'],
465 'length' => 25,
466 'suggest_limit' => 5,
467 'lowercase' => false,
468 ];
469
470 $email = [
471 'from_name' => $_subscribes['from_name'],
472 'from_email' => $_subscribes['from_email'],
473 'admin_emails' => $_subscribes['admin_emails'],
474 'new_topic_notify' => $_subscribes['new_topic_notify'],
475 'new_reply_notify' => $_subscribes['new_reply_notify'],
476 'disable_new_user_admin_notification' => $_features['disable_new_user_admin_notification'],
477 'report_email_subject' => _wpforo_emails_old_shortcodes_to_new( $_subscribes['report_email_subject'] ),
478 'report_email_message' => _wpforo_emails_old_shortcodes_to_new( $_subscribes['report_email_message'] ),
479 'overwrite_new_user_notification_admin' => $_subscribes['overwrite_new_user_notification_admin'],
480 'wp_new_user_notification_email_admin_subject' => _wpforo_emails_old_shortcodes_to_new( $_subscribes['wp_new_user_notification_email_admin_subject'] ),
481 'wp_new_user_notification_email_admin_message' => _wpforo_emails_old_shortcodes_to_new( $_subscribes['wp_new_user_notification_email_admin_message'] ),
482 'overwrite_new_user_notification' => $_subscribes['overwrite_new_user_notification'],
483 'wp_new_user_notification_email_subject' => _wpforo_emails_old_shortcodes_to_new($_subscribes['wp_new_user_notification_email_subject']),
484 'wp_new_user_notification_email_message' => _wpforo_emails_old_shortcodes_to_new($_subscribes['wp_new_user_notification_email_message']),
485 'overwrite_reset_password_email' => $_subscribes['overwrite_reset_password_email_message'],
486 'reset_password_email_message' => _wpforo_emails_old_shortcodes_to_new($_subscribes['reset_password_email_message']),
487 ];
488 $email['admin_emails'] = sanitize_text_field( (string) $email['admin_emails'] );
489 $email['admin_emails'] = array_map( 'sanitize_email', preg_split('#\s*,\s*#u', trim($email['admin_emails'])) );
490 $email['admin_emails'] = array_filter( $email['admin_emails'] );
491 if( !$email['admin_emails'] ) $email['admin_emails'] = (array) get_option( 'admin_email' );
492
493 $subscriptions = [
494 'subscribe_confirmation' => $_features['subscribe_conf'],
495 'subscribe_checkbox_on_post_editor' => $_features['subscribe_checkbox_on_post_editor'],
496 'subscribe_checkbox_default_status' => $_features['subscribe_checkbox_default_status'],
497 'user_mention_notify' => $_subscribes['user_mention_notify'],
498 'user_following_notify' => true,
499 'confirmation_email_subject' => _wpforo_emails_old_shortcodes_to_new($_subscribes['confirmation_email_subject']),
500 'confirmation_email_message' => _wpforo_emails_old_shortcodes_to_new($_subscribes['confirmation_email_message']),
501 'new_topic_notification_email_subject' => _wpforo_emails_old_shortcodes_to_new($_subscribes['new_topic_notification_email_subject']),
502 'new_topic_notification_email_message' => _wpforo_emails_old_shortcodes_to_new($_subscribes['new_topic_notification_email_message']),
503 'new_post_notification_email_subject' => _wpforo_emails_old_shortcodes_to_new($_subscribes['new_post_notification_email_subject']),
504 'new_post_notification_email_message' => _wpforo_emails_old_shortcodes_to_new($_subscribes['new_post_notification_email_message']),
505 'user_mention_email_subject' => _wpforo_emails_old_shortcodes_to_new($_subscribes['user_mention_email_subject']),
506 'user_mention_email_message' => _wpforo_emails_old_shortcodes_to_new($_subscribes['user_mention_email_message']),
507 'user_following_email_subject' => _wpforo_emails_old_shortcodes_to_new($_subscribes['user_post_notification_email_subject']),
508 'user_following_email_message' => _wpforo_emails_old_shortcodes_to_new($_subscribes['user_post_notification_email_message']),
509 ];
510
511 $notifications = [
512 'notifications' => $_features['notifications'],
513 'notifications_live' => $_features['notifications-live'],
514 'notifications_bar' => $_features['notifications-bar'],
515 ];
516
517 $logging = [
518 'view_logging' => $_features['view-logging'],
519 'track_logging' => $_features['track-logging'],
520 'goto_unread' => $_features['goto-unread'],
521 'goto_unread_button' => $_features['goto-unread-button'],
522 'display_forum_current_viewers' => $_forums['display_current_viewers'],
523 'display_topic_current_viewers' => $_posts['display_current_viewers'],
524 'display_recent_viewers' => $_posts['display_recent_viewers'],
525 'display_admin_viewers' => $_posts['display_admin_viewers'],
526 ];
527
528 $seo = [
529 'seo_title' => $_features['seo-title'],
530 'seo_meta' => $_features['seo-meta'],
531 'seo_profile' => $_features['seo-profile'],
532 'forums_sitemap' => $_seo['forums_sitemap'],
533 'topics_sitemap' => $_seo['topics_sitemap'],
534 'members_sitemap' => $_seo['members_sitemap'],
535 'dofollow' => array_filter( preg_split( '#\s+#', $_tools_misc['dofollow'] ) ),
536 'noindex' => array_filter( preg_split( '#\s+#', $_tools_misc['noindex'] ) ),
537 ];
538
539 $antispam = [
540 'spam_filter' => $_tools_antispam['spam_filter'],
541 'spam_user_ban' => $_tools_antispam['spam_user_ban'],
542 'spam_filter_level_topic' => $_tools_antispam['spam_filter_level_topic'],
543 'spam_filter_level_post' => $_tools_antispam['spam_filter_level_post'],
544 'new_user_max_posts' => $_tools_antispam['new_user_max_posts'],
545 'unapprove_post_if_user_is_new' => $_tools_antispam['unapprove_post_if_user_is_new'],
546 'min_number_posts_to_attach' => $_tools_antispam['min_number_post_to_attach'],
547 'min_number_posts_to_link' => $_tools_antispam['min_number_post_to_link'],
548 'limited_file_ext' => array_unique( array_filter( preg_split( '#\s*\|\s*|\s*,\s*|\s+#', trim( (string) $_tools_antispam['limited_file_ext'] ) ) ) ),
549 'spam_file_scanner' => $_tools_antispam['spam_file_scanner'],
550 'exclude_file_ext' => array_unique( array_filter( preg_split( '#\s*\|\s*|\s*,\s*|\s+#', trim( (string) $_tools_antispam['exclude_file_ext'] ) ) ) ),
551 ];
552
553 $rss = [
554 'feed' => $_features['rss-feed'],
555 'feed_general' => true,
556 'feed_forum' => true,
557 'feed_topic' => true,
558 ];
559
560 $social = [
561 'sb' => $_api['sb'],
562 'sb_on' => $_api['sb_on'],
563 'sb_toggle_on' => $_api['sb_toggle_on'],
564 'sb_style' => $_api['sb_style'],
565 'sb_type' => $_api['sb_type'],
566 'sb_toggle' => $_api['sb_toggle'],
567 'sb_toggle_type' => $_api['sb_toggle_type'],
568 'sb_icon' => $_api['sb_icon'],
569 'sb_location' => $_api['sb_location'],
570 'sb_location_toggle' => $_api['sb_location_toggle'],
571 ];
572
573 $legal = [
574 'contact_page_url' => $_tools_legal['contact_page_url'],
575 'checkbox_terms_privacy' => $_tools_legal['checkbox_terms_privacy'],
576 'checkbox_email_password' => $_tools_legal['checkbox_email_password'],
577 'page_terms' => $_tools_legal['page_terms'],
578 'page_privacy' => $_tools_legal['page_privacy'],
579 'checkbox_forum_privacy' => $_tools_legal['checkbox_forum_privacy'],
580 'forum_privacy_text' => $_tools_legal['forum_privacy_text'],
581 'checkbox_fb_login' => $_tools_legal['checkbox_fb_login'],
582 'cookies' => $_tools_legal['cookies'],
583 'rules_text' => $_tools_legal['rules_text'],
584 'rules_checkbox' => $_tools_legal['rules_checkbox'],
585 ];
586
587 wpforo_update_option( 'wpforo_general', $general );
588 wpforo_update_option( 'wpforo_members', $members );
589 wpforo_update_option( 'wpforo_profiles', $profiles );
590 wpforo_update_option( 'wpforo_rating', $rating );
591 wpforo_update_option( 'wpforo_authorization', $authorization );
592 wpforo_update_option( 'wpforo_email', $email );
593 wpforo_update_option( 'wpforo_recaptcha', $recaptcha );
594 wpforo_update_option( 'wpforo_buddypress', $buddypress );
595 wpforo_update_option( 'wpforo_um', $um );
596 wpforo_update_option( 'wpforo_legal', $legal );
597 wpforo_update_option( 'forums', $forums );
598 wpforo_update_option( 'topics', $topics );
599 wpforo_update_option( 'posting', $posting );
600 wpforo_update_option( 'components', $components );
601 // wpforo_update_option( 'styles_classic', $styles );
602 wpforo_update_option( 'styles_2022', $styles );
603 wpforo_update_option( 'tags', $tags );
604 wpforo_update_option( 'subscriptions', $subscriptions );
605 wpforo_update_option( 'notifications', $notifications );
606 wpforo_update_option( 'logging', $logging );
607 wpforo_update_option( 'seo', $seo );
608 wpforo_update_option( 'antispam', $antispam );
609 wpforo_update_option( 'rss', $rss );
610 wpforo_update_option( 'social', $social );
611
612 WPF()->phrase->set_language_status( $_general['lang'] );
613 WPF()->usergroup->set_default( wpforo_get_option( 'wpforo_default_groupid', 3 ) );
614 }
615
616 function _wpforo_migrate_old_widgets_to_new(){
617 if( $sidebars_widgets = get_option('sidebars_widgets') ){
618 if( wpfkey( $sidebars_widgets, 'forum-sidebar' ) && ! wpfval( $sidebars_widgets, 'wpforo_sidebar' ) ){
619 $sidebars_widgets['wpforo_sidebar'] = $sidebars_widgets['forum-sidebar'];
620 unset( $sidebars_widgets['forum-sidebar'] );
621 }
622
623 $sidebars_widgets = array_map(
624 function($item){
625 if( ! is_numeric( $item ) ){
626 $item = str_replace( [ 'wpforo_widget_recent_replies', 'wpforo_widget_' ], [ 'wpforo_recent_posts', 'wpforo_' ], $item );
627 }
628 return $item;
629 },
630 $sidebars_widgets
631 );
632
633 ### -------
634 global $wpdb;
635 $sql = "SELECT * FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%wpforo_widget_%'";
636 if( $options = $wpdb->get_results( $sql, ARRAY_A ) ){
637 foreach ( $options as $option ){
638 $v = unserialize( $option['option_value'] );
639 if( wpfval($v, '_multiwidget') && count( $v ) > 1 ){
640 update_option( str_replace( [ 'wpforo_widget_recent_replies', 'wpforo_widget_' ], [ 'wpforo_recent_posts', 'wpforo_' ], $option['option_name'] ), $v );
641 }
642 }
643 }
644
645 update_option( 'sidebars_widgets', $sidebars_widgets );
646 }
647 }
648