wpForo Forum - Version 1.9.7

Version Description

Download this release

Release Info

Developer Tomdever
Plugin Icon 128x128 wpForo Forum
Version 1.9.7
Comparing to
See all releases

Code changes from version 1.9.6 to 1.9.7

readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: gVectors Team
3
  Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
  Requires at least: 4.1
5
  Tested up to: 5.7
6
- Stable tag: 1.9.6
7
  Requires PHP: 5.6 and higher
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -165,6 +165,42 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
165
 
166
  == Changelog ==
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  = wpForo Forum 1.9.6 | 12.03.2021 =
169
 
170
  [wpForo Forum v1.9.6 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-9-6-is-released/)
@@ -177,13 +213,6 @@ Find wpForo forum plugin addons on [gVectors Team website...](https://gvectors.c
177
  * Core Update: Important changes for wpForo Private Message addon
178
  * Core Update: Important changes for wpForo Topic Custom Fields addon
179
 
180
- IMPORTANT NOTES for UPDATE
181
-
182
- - After the update, please delete all caches.
183
- - If you have a Minifier/Optimizer plugins please delete all caches.
184
- - If you use CDN and found some issues please purge it.
185
- - Some JS and CSS files are changed, please refresh (press Ctrl+F5) on forum front-end twice to reset browser cache, otherwise you'll see crashed design.
186
-
187
 
188
  = wpForo Forum 1.9.4 / 1.9.5 | 25.02.2021 =
189
 
3
  Tags: forum, forums, forum plugin, WordPress forum plugin, community, discussion
4
  Requires at least: 4.1
5
  Tested up to: 5.7
6
+ Stable tag: 1.9.7
7
  Requires PHP: 5.6 and higher
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
165
 
166
  == Changelog ==
167
 
168
+ = wpForo Forum 1.9.7 | 11.06.2021 =
169
+
170
+ [wpForo Forum v1.9.7 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-9-7-is-released/)
171
+
172
+ * Added: MySQL 8 Compatibility
173
+ * Added: Social Network fields in forum profiles are updated
174
+ * Removed: ICQ, AOL IM, Google+, Yahoo, MSN
175
+ * Added: LinkedIn, Instagram, Telegram, YouTube, VKontakte
176
+ * Added: Hooks on user banning / unbanning actions
177
+ * Added: User banning `do_action('wpforo_after_ban_user', $userid);`
178
+ * Added: User unbanning `do_action('wpforo_after_unban_user', $userid);`
179
+ * Added: Hooks to set custom timeout for forum top/right pop-up messages
180
+ * Added: Forum hook `wpforo_notice_timeout_success`
181
+ * Added: Forum hook `wpforo_notice_timeout_error`
182
+ * Added: Built-in forum memory cache is improved
183
+ * Added: Adds space after @nickname on clicking [reply] button
184
+ * Added: Admins are now able to manage user subscriptions in user's My Profile > Subscriptions Tab
185
+ * Added: QAPage schema to wpForo Q&A Forum Layout. Now forum Q&A layout topics/questions are eligible to have a rich result displayed on the search results page. [More information...](https://developers.google.com/search/docs/data-types/qapage)
186
+ * Fixed Bug: Redirection issue when URL contains TCP port other than 80
187
+ * Fixed Bug: Sub-forums are not displayed in threaded layout (MySQL 8 issue)
188
+ * Fixed Bug: Clean [spoiler] shortcode from recent posts list
189
+ * Fixed Bug: Back slash before all apostrophes in emails
190
+ * Fixed Bug: Secure redirection, switched to `wp_safe_redirect()`
191
+ * Fixed Bug: Problem with spoiler, crashing post content and forum layout
192
+ * Fixed Bug: Incorrect last login information for inactive users
193
+ * Fixed Bug: Reduced DB queries and some duplicated SQLs are removed
194
+
195
+
196
+ IMPORTANT NOTES for UPDATE
197
+
198
+ - After the update, please delete all caches.
199
+ - If you have a Minifier/Optimizer plugins please delete all caches.
200
+ - If you use CDN and found some issues please purge it.
201
+ - Some JS and CSS files are changed, please refresh (press Ctrl+F5, on Mac CMD+Alt+E) on forum front-end twice to reset browser cache, otherwise you'll see crashed design.
202
+
203
+
204
  = wpForo Forum 1.9.6 | 12.03.2021 =
205
 
206
  [wpForo Forum v1.9.6 Release Summary](https://wpforo.com/community/wpforo-announcements/wpforo-1-9-6-is-released/)
213
  * Core Update: Important changes for wpForo Private Message addon
214
  * Core Update: Important changes for wpForo Topic Custom Fields addon
215
 
 
 
 
 
 
 
 
216
 
217
  = wpForo Forum 1.9.4 / 1.9.5 | 25.02.2021 =
218
 
wpf-admin/dashboard.php CHANGED
@@ -77,7 +77,7 @@
77
  </tr>
78
  <tr class="wpf-dw-tr">
79
  <td class="wpf-dw-td">MySQL Version</td>
80
- <td class="wpf-dw-td-value"><?php echo WPF()->db->db_version(); ?></td>
81
  </tr>
82
  <tr class="wpf-dw-tr">
83
  <td class="wpf-dw-td">PHP Max Post Size</td>
77
  </tr>
78
  <tr class="wpf-dw-tr">
79
  <td class="wpf-dw-td">MySQL Version</td>
80
+ <td class="wpf-dw-td-value"><?php echo WPF()->db->db_server_info(); ?></td>
81
  </tr>
82
  <tr class="wpf-dw-tr">
83
  <td class="wpf-dw-td">PHP Max Post Size</td>
wpf-admin/includes/member-listtable.php CHANGED
@@ -55,6 +55,8 @@ class wpForoMembersListTable extends WP_List_Table {
55
  return WPF()->member->blog_posts($item['userid']);
56
  case 'blog_comments':
57
  return WPF()->member->blog_comments($item['userid'], $item['user_email']);
 
 
58
  default:
59
  return $item[ $column_name ];
60
  }
55
  return WPF()->member->blog_posts($item['userid']);
56
  case 'blog_comments':
57
  return WPF()->member->blog_comments($item['userid'], $item['user_email']);
58
+ case 'last_login':
59
+ return ( $item['online_time'] ) ? $item['last_login'] : '-';
60
  default:
61
  return $item[ $column_name ];
62
  }
wpf-admin/tools-tabs/debug.php CHANGED
@@ -221,7 +221,7 @@
221
  </tr>
222
  <tr class="wpf-dw-tr">
223
  <td class="wpf-dw-td">MySQL Version</td>
224
- <td class="wpf-dw-td-value"><?php echo WPF()->db->db_version(); ?></td>
225
  </tr>
226
  <tr class="wpf-dw-tr">
227
  <td class="wpf-dw-td">PHP Max Post Size</td>
221
  </tr>
222
  <tr class="wpf-dw-tr">
223
  <td class="wpf-dw-td">MySQL Version</td>
224
+ <td class="wpf-dw-td-value"><?php echo WPF()->db->db_server_info(); ?></td>
225
  </tr>
226
  <tr class="wpf-dw-tr">
227
  <td class="wpf-dw-td">PHP Max Post Size</td>
wpf-assets/js/ajax.js CHANGED
@@ -66,7 +66,7 @@ $wpf(document).ready(function ($) {
66
  $this.children(".wpf-like-count").text(response.data.count);
67
  }
68
  wpforo_load_hide();
69
- wpforo_notice_show(response.data.notice);
70
  $this.removeClass('wpf-processing');
71
  });
72
  });
@@ -98,7 +98,7 @@ $wpf(document).ready(function ($) {
98
  $this.children(".wpf-like-count").text(response.data.count);
99
  }
100
  wpforo_load_hide();
101
- wpforo_notice_show(response.data.notice);
102
  $this.removeClass('wpf-processing');
103
  });
104
  });
@@ -124,7 +124,7 @@ $wpf(document).ready(function ($) {
124
  }).done(function (response) {
125
  if( response.success ) $this.parents('.post-wrap').find('.wpfvote-num').text(response.data.votes).fadeIn();
126
  wpforo_load_hide();
127
- wpforo_notice_show(response.data.notice);
128
  buttons.removeClass('wpf-processing');
129
  });
130
  });
@@ -148,7 +148,7 @@ $wpf(document).ready(function ($) {
148
  }).done(function (response) {
149
  if( response.success ) $this.parents('.post-wrap').find('.wpfvote-num').text(response.data.votes).fadeIn();
150
  wpforo_load_hide();
151
- wpforo_notice_show(response.data.notice);
152
  buttons.removeClass('wpf-processing');
153
  });
154
  });
@@ -176,7 +176,7 @@ $wpf(document).ready(function ($) {
176
  }, 300);
177
  }
178
  wpforo_load_hide();
179
- wpforo_notice_show(response.data.notice);
180
  $this.removeClass('wpf-processing');
181
  });
182
  });
@@ -202,7 +202,7 @@ $wpf(document).ready(function ($) {
202
  }, 300);
203
  }
204
  wpforo_load_hide();
205
- wpforo_notice_show(response.data.notice);
206
  $this.removeClass('wpf-processing');
207
  });
208
  });
@@ -281,7 +281,7 @@ $wpf(document).ready(function ($) {
281
  wpforo_dialog_hide();
282
  $('#wpforo-report-content').val('');
283
  wpforo_load_hide();
284
- wpforo_notice_show(response.data);
285
  $this.removeClass('wpf-processing');
286
  });
287
  }
@@ -311,7 +311,7 @@ $wpf(document).ready(function ($) {
311
  }
312
  }
313
  wpforo_load_hide();
314
- wpforo_notice_show(response.data.notice);
315
  $this.removeClass('wpf-processing');
316
  });
317
  });
@@ -341,7 +341,7 @@ $wpf(document).ready(function ($) {
341
  }
342
  }
343
  wpforo_load_hide();
344
- wpforo_notice_show(response.data.notice);
345
  $this.removeClass('wpf-processing');
346
  });
347
  });
@@ -695,7 +695,7 @@ $wpf(document).ready(function ($) {
695
  }
696
  }
697
  wpforo_load_hide();
698
- wpforo_notice_show(response.data.notice);
699
  $this.removeClass('wpf-processing');
700
  });
701
  }
@@ -736,7 +736,7 @@ $wpf(document).ready(function ($) {
736
  $("#wpfsubscribe-" + itemid).removeClass('wpf-subscribe-' + type).addClass('wpf-unsubscribe-' + type).text(' ' + wpforo_phrase('Unsubscribe'));
737
  }
738
  wpforo_load_hide();
739
- wpforo_notice_show(response.data.notice);
740
  $this.removeClass('wpf-processing');
741
  });
742
  });
@@ -775,7 +775,7 @@ $wpf(document).ready(function ($) {
775
  $("#wpfsubscribe-" + itemid).removeClass('wpf-unsubscribe-' + type).addClass('wpf-subscribe-' + type).text(' ' + button_phrase);
776
  }
777
  wpforo_load_hide();
778
- wpforo_notice_show(response.data.notice);
779
  $this.removeClass('wpf-processing');
780
  });
781
  });
66
  $this.children(".wpf-like-count").text(response.data.count);
67
  }
68
  wpforo_load_hide();
69
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
70
  $this.removeClass('wpf-processing');
71
  });
72
  });
98
  $this.children(".wpf-like-count").text(response.data.count);
99
  }
100
  wpforo_load_hide();
101
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
102
  $this.removeClass('wpf-processing');
103
  });
104
  });
124
  }).done(function (response) {
125
  if( response.success ) $this.parents('.post-wrap').find('.wpfvote-num').text(response.data.votes).fadeIn();
126
  wpforo_load_hide();
127
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
128
  buttons.removeClass('wpf-processing');
129
  });
130
  });
148
  }).done(function (response) {
149
  if( response.success ) $this.parents('.post-wrap').find('.wpfvote-num').text(response.data.votes).fadeIn();
150
  wpforo_load_hide();
151
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
152
  buttons.removeClass('wpf-processing');
153
  });
154
  });
176
  }, 300);
177
  }
178
  wpforo_load_hide();
179
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
180
  $this.removeClass('wpf-processing');
181
  });
182
  });
202
  }, 300);
203
  }
204
  wpforo_load_hide();
205
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
206
  $this.removeClass('wpf-processing');
207
  });
208
  });
281
  wpforo_dialog_hide();
282
  $('#wpforo-report-content').val('');
283
  wpforo_load_hide();
284
+ wpforo_notice_show(response.data, (response.success ? 'success' : 'error'));
285
  $this.removeClass('wpf-processing');
286
  });
287
  }
311
  }
312
  }
313
  wpforo_load_hide();
314
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
315
  $this.removeClass('wpf-processing');
316
  });
317
  });
341
  }
342
  }
343
  wpforo_load_hide();
344
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
345
  $this.removeClass('wpf-processing');
346
  });
347
  });
695
  }
696
  }
697
  wpforo_load_hide();
698
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
699
  $this.removeClass('wpf-processing');
700
  });
701
  }
736
  $("#wpfsubscribe-" + itemid).removeClass('wpf-subscribe-' + type).addClass('wpf-unsubscribe-' + type).text(' ' + wpforo_phrase('Unsubscribe'));
737
  }
738
  wpforo_load_hide();
739
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
740
  $this.removeClass('wpf-processing');
741
  });
742
  });
775
  $("#wpfsubscribe-" + itemid).removeClass('wpf-unsubscribe-' + type).addClass('wpf-subscribe-' + type).text(' ' + button_phrase);
776
  }
777
  wpforo_load_hide();
778
+ wpforo_notice_show(response.data.notice, (response.success ? 'success' : 'error'));
779
  $this.removeClass('wpf-processing');
780
  });
781
  });
wpf-assets/js/frontend.js CHANGED
@@ -285,6 +285,12 @@ var wpforo_editor = {
285
  }
286
  };
287
 
 
 
 
 
 
 
288
  function wpforo_notice_clear() {
289
  var msg_box = $wpf("#wpf-msg-box");
290
  msg_box.hide();
@@ -311,9 +317,12 @@ function wpforo_notice_show(notice, type){
311
  msg_box.append(notice);
312
  msg_box.appendTo('body');
313
  msg_box.show(150);
314
- notice.delay(type === 'error' ? 8000 : 4000).fadeOut(200, function () {
315
- $wpf(this).remove();
316
- });
 
 
 
317
  }
318
 
319
  function wpforo_notice_hide(){
@@ -638,8 +647,8 @@ $wpf(document).ready(function($){
638
  wpforo_load_hide();
639
  });
640
 
641
- $(document).on('click', '#wpf-msg-box', function(){
642
- $(this).hide();
643
  });
644
 
645
  /* Home page loyouts toipcs toglle */
@@ -712,7 +721,7 @@ $wpf(document).ready(function($){
712
  var userid = parseInt( post_wrap.data('userid') );
713
  var mention = post_wrap.data('mention');
714
  var isowner = parseInt( post_wrap.data('isowner') );
715
- var content = ( !isowner && userid && mention ? '@' + mention + "\r\n" : '' );
716
 
717
  wpforo_editor.set_content( content, wpforo_editor.get_main() );
718
 
@@ -740,7 +749,7 @@ $wpf(document).ready(function($){
740
  var userid = parseInt( post_wrap.data('userid') );
741
  var mention = post_wrap.data('mention');
742
  var isowner = parseInt( post_wrap.data('isowner') );
743
- var content = ( !isowner && userid && mention ? '@' + mention + "\r\n" : '' );
744
 
745
  wpforo_editor.set_content( content, wpforo_editor.get_main() );
746
 
@@ -782,7 +791,7 @@ $wpf(document).ready(function($){
782
  var userid = parseInt( comment_wrap.data('userid') );
783
  var mention = comment_wrap.data('mention');
784
  var isowner = parseInt( comment_wrap.data('isowner') );
785
- var content = ( !isowner && userid && mention ? '@' + mention + "\r\n" : '' );
786
 
787
  wpforo_editor.set_content( content, textareaid );
788
  });
285
  }
286
  };
287
 
288
+ function wpforo_notice_get_timeout(type){
289
+ if( !type ) type = 'neutral';
290
+ if( wpforo.notice.timeouts[type] !== undefined ) return parseInt( wpforo.notice.timeouts[type] );
291
+ return 8000;
292
+ }
293
+
294
  function wpforo_notice_clear() {
295
  var msg_box = $wpf("#wpf-msg-box");
296
  msg_box.hide();
317
  msg_box.append(notice);
318
  msg_box.appendTo('body');
319
  msg_box.show(150);
320
+ var timeout = wpforo_notice_get_timeout(type);
321
+ if( timeout ){
322
+ notice.delay( timeout ).fadeOut(200, function () {
323
+ $wpf(this).remove();
324
+ });
325
+ }
326
  }
327
 
328
  function wpforo_notice_hide(){
647
  wpforo_load_hide();
648
  });
649
 
650
+ $(document).on('click', '#wpf-msg-box p', function(){
651
+ $(this).remove();
652
  });
653
 
654
  /* Home page loyouts toipcs toglle */
721
  var userid = parseInt( post_wrap.data('userid') );
722
  var mention = post_wrap.data('mention');
723
  var isowner = parseInt( post_wrap.data('isowner') );
724
+ var content = ( !isowner && userid && mention ? '@' + mention + "&nbsp;" : '' );
725
 
726
  wpforo_editor.set_content( content, wpforo_editor.get_main() );
727
 
749
  var userid = parseInt( post_wrap.data('userid') );
750
  var mention = post_wrap.data('mention');
751
  var isowner = parseInt( post_wrap.data('isowner') );
752
+ var content = ( !isowner && userid && mention ? '@' + mention + "&nbsp;" : '' );
753
 
754
  wpforo_editor.set_content( content, wpforo_editor.get_main() );
755
 
791
  var userid = parseInt( comment_wrap.data('userid') );
792
  var mention = comment_wrap.data('mention');
793
  var isowner = parseInt( comment_wrap.data('isowner') );
794
+ var content = ( !isowner && userid && mention ? '@' + mention + "&nbsp;" : '' );
795
 
796
  wpforo_editor.set_content( content, textareaid );
797
  });
wpf-includes/class-actions.php CHANGED
@@ -220,7 +220,7 @@ class wpForoAction {
220
  $topic['topicurl'] = wpforo_home_url();
221
  } else {
222
  $topic = wpforo_topic( $topicid );
223
- $topic['topicurl'] = ( $topic['url'] ) ? $topic['url'] : WPF()->topic->get_topic_url( $topicid );
224
  $posts = WPF()->post->get_posts( array(
225
  'topicid' => $topicid,
226
  'row_count' => $topic_rss_items,
@@ -299,7 +299,7 @@ class wpForoAction {
299
  WPF()->log->mark_all_read();
300
  $current_url = wpforo_get_request_uri();
301
  $current_url = strtok( $current_url, '?');
302
- wp_redirect($current_url);
303
  exit();
304
  }
305
  }
@@ -328,7 +328,7 @@ class wpForoAction {
328
  WPF()->activity->read_notification( $id );
329
  $current_url = wpforo_get_request_uri();
330
  $current_url = strtok( $current_url, '?');
331
- wp_redirect($current_url);
332
  exit();
333
  }
334
  }
@@ -355,7 +355,7 @@ class wpForoAction {
355
  WPF()->member->reset($userid);
356
  if( WPF()->member->options['redirect_url_after_register'] ){
357
  $redirect_url = WPF()->member->options['redirect_url_after_register'];
358
- }elseif( $redirect_to = wpfval($_GET, 'redirect_to') ){
359
  $redirect_url = urldecode($redirect_to);
360
  }elseif( is_wpforo_url() ){
361
  $redirect_url = preg_replace('#\?.*$#is', '', wpforo_get_request_uri());
@@ -363,7 +363,7 @@ class wpForoAction {
363
  $redirect_url = ( wpforo_feature('user-register-email-confirm') ? wpforo_home_url() : WPF()->member->get_profile_url( $userid, 'account' ) );
364
  }
365
 
366
- wp_redirect($redirect_url);
367
  exit();
368
  }
369
  }
@@ -388,22 +388,21 @@ class wpForoAction {
388
  update_user_meta( $user->ID, '_wpf_login_times', $wpf_login_times );
389
  if( WPF()->member->options['redirect_url_after_login'] ){
390
  $redirect_url = WPF()->member->options['redirect_url_after_login'];
391
- }elseif( $redirect_to = wpfval($_GET, 'redirect_to') ){
392
  $redirect_url = urldecode($redirect_to);
393
  }elseif( is_wpforo_url() ){
394
  $redirect_url = preg_replace('#\?.*$#is', '', wpforo_get_request_uri());
395
  }else{
396
  $redirect_url = wpforo_home_url();
397
  }
398
- wp_redirect($redirect_url);
399
- exit();
400
  }else{
401
  $args = array();
402
  foreach($user->errors as $u_err) $args[] = $u_err[0];
403
  WPF()->notice->add($args, 'error');
404
- wp_redirect( wpforo_get_request_uri() );
405
- exit();
406
  }
 
407
  }
408
  }
409
 
@@ -418,18 +417,18 @@ class wpForoAction {
418
  ( WPF()->perm->usergroup_can('em') && WPF()->perm->user_can_manage_user( WPF()->current_userid, $uid )) ) ){
419
  WPF()->notice->clear();
420
  WPF()->notice->add('Permission denied', 'error');
421
- wp_redirect(wpforo_get_request_uri());
422
  exit();
423
  }
424
  if( $user = WPF()->member->update($_POST) ){
425
  if( $profile_url = WPF()->member->get_profile_url( $uid, 'account') ){
426
- wp_redirect($profile_url);
427
  exit();
428
  }
429
  }
430
  }
431
 
432
- wp_redirect(wpforo_get_request_uri());
433
  exit();
434
  }
435
 
@@ -441,10 +440,10 @@ class wpForoAction {
441
  $args = $_REQUEST['topic'];
442
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
443
  if( $topicid = WPF()->topic->add($args) ){
444
- wp_redirect( WPF()->topic->get_topic_url($topicid) );
445
  exit();
446
  }
447
- wp_redirect( wpforo_get_request_uri() );
448
  exit();
449
  }
450
 
@@ -456,10 +455,10 @@ class wpForoAction {
456
  $args = $_REQUEST['topic'];
457
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
458
  if( $topicid = WPF()->topic->edit($args) ){
459
- wp_redirect( WPF()->topic->get_topic_url($topicid) );
460
  exit();
461
  }
462
- wp_redirect( wpforo_get_request_uri() );
463
  exit();
464
  }
465
 
@@ -471,10 +470,10 @@ class wpForoAction {
471
  $args = $_REQUEST['post'];
472
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
473
  if( $postid = WPF()->post->add($args) ){
474
- wp_redirect( WPF()->post->get_post_url( $postid ) );
475
  exit();
476
  }
477
- wp_redirect( wpforo_get_request_uri() );
478
  exit();
479
  }
480
 
@@ -486,10 +485,10 @@ class wpForoAction {
486
  $args = $_REQUEST['post'];
487
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
488
  if( $postid = WPF()->post->edit($args) ){
489
- wp_redirect( WPF()->post->get_post_url( $postid ) );
490
  exit();
491
  }
492
- wp_redirect( wpforo_get_request_uri() );
493
  exit();
494
  }
495
 
@@ -503,12 +502,12 @@ class wpForoAction {
503
  $forumid = intval( wpfval($_POST['topic_move'], 'forumid') );
504
  if( $topicid && $forumid ){
505
  WPF()->topic->move($topicid, $forumid);
506
- wp_redirect( WPF()->topic->get_topic_url($topicid) );
507
  exit();
508
  }
509
  }
510
 
511
- wp_redirect( wpforo_get_request_uri() );
512
  exit();
513
  }
514
 
@@ -530,7 +529,7 @@ class wpForoAction {
530
  WPF()->notice->add('Target Topic not found', 'error');
531
  }
532
  }
533
- wp_redirect($redirect_to);
534
  exit();
535
  }
536
 
@@ -565,7 +564,7 @@ class wpForoAction {
565
  }
566
  }
567
  }
568
- wp_redirect($redirect_to);
569
  exit();
570
  }
571
 
@@ -578,7 +577,7 @@ class wpForoAction {
578
  WPF()->sbscrb->edit($sbs_key);
579
  $redirect_url = wpforo_home_url( preg_replace('#\?.*$#is', '', WPF()->current_url) );
580
  if( WPF()->member->options['redirect_url_after_confirm_sbscrb'] ) $redirect_url = WPF()->member->options['redirect_url_after_confirm_sbscrb'];
581
- wp_redirect($redirect_url);
582
  exit();
583
  }
584
  }
@@ -592,7 +591,7 @@ class wpForoAction {
592
  WPF()->sbscrb->delete($sbs_key);
593
  $redirect_url = wpforo_home_url( preg_replace('#\?.*$#is', '', WPF()->current_url) );
594
  if( WPF()->member->options['redirect_url_after_confirm_sbscrb'] ) $redirect_url = WPF()->member->options['redirect_url_after_confirm_sbscrb'];
595
- wp_redirect($redirect_url);
596
  exit();
597
  }
598
  }
@@ -601,11 +600,12 @@ class wpForoAction {
601
  * subscribe_manager form submit action
602
  */
603
  public function subscribe_manager(){
 
604
  $data = ( !empty($_POST['wpforo']['forums']) ? array_map( 'sanitize_title', $_POST['wpforo']['forums'] ) : array() );
605
  $all = ( !empty($_POST['wpforo']['check_all']) ? sanitize_title($_POST['wpforo']['check_all']) : '' );
606
 
607
- WPF()->sbscrb->reset($data, $all);
608
- wp_redirect( wpforo_home_url(wpforo_get_template_slug('subscriptions')) );
609
  exit();
610
  }
611
 
@@ -617,7 +617,7 @@ class wpForoAction {
617
 
618
  if(!current_user_can('administrator')){
619
  WPF()->notice->add('Permission denied', 'error');
620
- wp_redirect(admin_url());
621
  exit();
622
  }
623
 
@@ -629,9 +629,9 @@ class wpForoAction {
629
  WPF()->member->clear_db_cache();
630
  wpforo_clean_cache();
631
  WPF()->notice->add('Synched Successfully!', 'success');
632
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
633
  }else{
634
- wp_redirect( htmlspecialchars_decode( wp_nonce_url( admin_url( 'admin.php?page=wpforo-community&wpfaction=wpforo_synch_user_profiles' ), 'wpforo_synch_user_profiles' ) ) );
635
  }
636
  exit();
637
  }
@@ -645,7 +645,7 @@ class wpForoAction {
645
 
646
  if(!current_user_can('administrator')){
647
  WPF()->notice->add('Permission denied', 'error');
648
- wp_redirect(admin_url());
649
  exit();
650
  }
651
 
@@ -655,7 +655,7 @@ class wpForoAction {
655
  WPF()->member->clear_db_cache();
656
  WPF()->notice->add('Deleted Successfully!', 'success');
657
 
658
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
659
  exit();
660
  }
661
 
@@ -667,7 +667,7 @@ class wpForoAction {
667
 
668
  if(!current_user_can('administrator')){
669
  WPF()->notice->add('Permission denied', 'error');
670
- wp_redirect(admin_url());
671
  exit();
672
  }
673
 
@@ -684,7 +684,7 @@ class wpForoAction {
684
  WPF()->notice->add('Updated Successfully!', 'success');
685
  }
686
 
687
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
688
  exit();
689
  }
690
 
@@ -696,7 +696,7 @@ class wpForoAction {
696
 
697
  if(!current_user_can('administrator')){
698
  WPF()->notice->add('Permission denied', 'error');
699
- wp_redirect(admin_url());
700
  exit();
701
  }
702
 
@@ -713,7 +713,7 @@ class wpForoAction {
713
  WPF()->topic->rebuild_first_last($topic);
714
  WPF()->topic->rebuild_stats($topic);
715
  }
716
- wp_redirect( htmlspecialchars_decode( wp_nonce_url( admin_url( 'admin.php?page=wpforo-community&wpfaction=wpforo_reset_topics_stats&topic_lastid=' . end($topicids) ), 'wpforo_reset_topics_stat' ) ) );
717
  }else{
718
  @WPF()->db->query( "UPDATE `".WPF()->tables->topics."` t
719
  INNER JOIN `".WPF()->tables->posts."` p ON p.`topicid` = t.`topicid` AND p.`is_answer` = 1
@@ -721,7 +721,7 @@ class wpForoAction {
721
  WHERE t.`solved` = 0" );
722
  WPF()->db->query("DELETE FROM `" . WPF()->db->options."` WHERE `option_name` LIKE 'wpforo_stat%'" );
723
  WPF()->notice->add('Updated Successfully!', 'success');
724
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
725
  }
726
  exit();
727
  }
@@ -735,7 +735,7 @@ class wpForoAction {
735
 
736
  if(!current_user_can('administrator')){
737
  WPF()->notice->add('Permission denied', 'error');
738
- wp_redirect(admin_url());
739
  exit();
740
  }
741
 
@@ -766,10 +766,10 @@ class wpForoAction {
766
  );
767
  }
768
 
769
- wp_redirect( htmlspecialchars_decode( wp_nonce_url( admin_url( 'admin.php?page=wpforo-community&wpfaction=wpforo_reset_users_stats&user_lastid=' . end($userids) ), 'wpforo_reset_users_stat' ) ) );
770
  }else{
771
  WPF()->notice->add('Updated Successfully!', 'success');
772
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
773
  }
774
  exit();
775
  }
@@ -783,7 +783,7 @@ class wpForoAction {
783
 
784
  if(!current_user_can('administrator')){
785
  WPF()->notice->add('Permission denied', 'error');
786
- wp_redirect(admin_url());
787
  exit();
788
  }
789
 
@@ -794,7 +794,7 @@ class wpForoAction {
794
  wpforo_clean_cache();
795
  WPF()->notice->add('Threads rebuilt successfully', 'success');
796
 
797
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
798
  exit();
799
  }
800
 
@@ -806,7 +806,7 @@ class wpForoAction {
806
 
807
  if(!current_user_can('administrator')){
808
  WPF()->notice->add('Permission denied', 'error');
809
- wp_redirect(admin_url());
810
  exit();
811
  }
812
 
@@ -816,7 +816,7 @@ class wpForoAction {
816
  WPF()->phrase->clear_cache();
817
  WPF()->notice->add('Deleted Successfully!', 'success');
818
 
819
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
820
  exit();
821
  }
822
 
@@ -828,7 +828,7 @@ class wpForoAction {
828
 
829
  if(!current_user_can('administrator')){
830
  WPF()->notice->add('Permission denied', 'error');
831
- wp_redirect(admin_url());
832
  exit();
833
  }
834
 
@@ -840,7 +840,7 @@ class wpForoAction {
840
  WPF()->notice->clear();
841
  WPF()->notice->add('Rebuilt Successfully!', 'success');
842
 
843
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
844
  exit();
845
  }
846
 
@@ -852,7 +852,7 @@ class wpForoAction {
852
 
853
  if(!current_user_can('administrator')){
854
  WPF()->notice->add('Permission denied', 'error');
855
- wp_redirect(admin_url());
856
  exit();
857
  }
858
 
@@ -865,7 +865,7 @@ class wpForoAction {
865
  WPF()->notice->add('Deleted Successfully!', 'success');
866
 
867
  $redirect = ( is_admin() ) ? admin_url('admin.php?page=wpforo-community') : wpforo_home_url();
868
- wp_redirect( $redirect );
869
  exit();
870
  }
871
 
@@ -877,7 +877,7 @@ class wpForoAction {
877
 
878
  if(!current_user_can('administrator')){
879
  WPF()->notice->add('Permission denied', 'error');
880
- wp_redirect(admin_url());
881
  exit();
882
  }
883
 
@@ -887,7 +887,7 @@ class wpForoAction {
887
  wpforo_clean_up();
888
  WPF()->notice->add('Cleaned Up!', 'success');
889
 
890
- wp_redirect(admin_url('admin.php?page=wpforo-community'));
891
  exit();
892
  }
893
 
@@ -897,13 +897,13 @@ class wpForoAction {
897
  public function dashboard_options_save(){
898
  if(!current_user_can('administrator')){
899
  WPF()->notice->add('Permission denied', 'error');
900
- wp_redirect(admin_url());
901
  exit();
902
  }
903
  if( $dashboard_count_per_page = (int) wpfval($_POST, 'wpforo_dashboard_count_per_page') ){
904
  update_option('wpforo_count_per_page', $dashboard_count_per_page );
905
  }
906
- wp_redirect( wpforo_get_request_uri() );
907
  exit();
908
  }
909
 
@@ -915,7 +915,7 @@ class wpForoAction {
915
  if( $page === 'wpforo-settings' ){
916
  if(!WPF()->perm->usergroup_can('ms')){
917
  WPF()->notice->add('Permission denied', 'error');
918
- wp_redirect(admin_url());
919
  exit();
920
  }
921
  }
@@ -945,7 +945,7 @@ class wpForoAction {
945
 
946
  if(!WPF()->perm->usergroup_can('ms')){
947
  WPF()->notice->add('Permission denied', 'error');
948
- wp_redirect(admin_url());
949
  exit();
950
  }
951
 
@@ -1021,7 +1021,7 @@ class wpForoAction {
1021
 
1022
  WPF()->member->clear_db_cache();
1023
  wpforo_clean_cache();
1024
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=general' ) );
1025
  exit();
1026
  }
1027
 
@@ -1033,7 +1033,7 @@ class wpForoAction {
1033
 
1034
  if(!WPF()->perm->usergroup_can('ms')){
1035
  WPF()->notice->add('Permission denied', 'error');
1036
- wp_redirect(admin_url());
1037
  exit();
1038
  }
1039
 
@@ -1041,7 +1041,7 @@ class wpForoAction {
1041
  WPF()->phrase->add_lang();
1042
  wpforo_clean_cache();
1043
  }
1044
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=general' ) );
1045
  exit();
1046
  }
1047
 
@@ -1053,7 +1053,7 @@ class wpForoAction {
1053
 
1054
  if(!WPF()->perm->usergroup_can('ms')){
1055
  WPF()->notice->add('Permission denied', 'error');
1056
- wp_redirect(admin_url());
1057
  exit();
1058
  }
1059
 
@@ -1071,7 +1071,7 @@ class wpForoAction {
1071
 
1072
  wpforo_clean_cache();
1073
  }
1074
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=forums' ) );
1075
  exit();
1076
  }
1077
 
@@ -1083,7 +1083,7 @@ class wpForoAction {
1083
 
1084
  if( !WPF()->perm->usergroup_can('ms') ){
1085
  WPF()->notice->add('Permission denied', 'error');
1086
- wp_redirect(admin_url());
1087
  exit();
1088
  }
1089
 
@@ -1109,7 +1109,7 @@ class wpForoAction {
1109
  wpforo_clean_cache();
1110
  }
1111
 
1112
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=posts' ) );
1113
  exit();
1114
  }
1115
 
@@ -1122,7 +1122,7 @@ class wpForoAction {
1122
 
1123
  if(!WPF()->perm->usergroup_can('ms')){
1124
  WPF()->notice->add('Permission denied', 'error');
1125
- wp_redirect(admin_url());
1126
  exit();
1127
  }
1128
 
@@ -1165,7 +1165,7 @@ class wpForoAction {
1165
  wpforo_clean_cache();
1166
  }
1167
 
1168
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=members' ) );
1169
  exit();
1170
  }
1171
 
@@ -1177,7 +1177,7 @@ class wpForoAction {
1177
 
1178
  if(!WPF()->perm->usergroup_can('ms')){
1179
  WPF()->notice->add('Permission denied', 'error');
1180
- wp_redirect(admin_url());
1181
  exit();
1182
  }
1183
 
@@ -1196,7 +1196,7 @@ class wpForoAction {
1196
  WPF()->seo->clear_cache();
1197
  }
1198
 
1199
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=features' ) );
1200
  exit();
1201
  }
1202
 
@@ -1208,7 +1208,7 @@ class wpForoAction {
1208
 
1209
  if(!WPF()->perm->usergroup_can('ms')){
1210
  WPF()->notice->add('Permission denied', 'error');
1211
- wp_redirect(admin_url());
1212
  exit();
1213
  }
1214
 
@@ -1225,7 +1225,7 @@ class wpForoAction {
1225
  }
1226
  }
1227
 
1228
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=api' ) );
1229
  exit();
1230
  }
1231
 
@@ -1237,7 +1237,7 @@ class wpForoAction {
1237
 
1238
  if(!WPF()->perm->usergroup_can('ms')){
1239
  WPF()->notice->add('Permission denied', 'error');
1240
- wp_redirect(admin_url());
1241
  exit();
1242
  }
1243
 
@@ -1267,7 +1267,7 @@ class wpForoAction {
1267
  wpforo_clean_cache();
1268
  }
1269
 
1270
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=styles' ) );
1271
  exit();
1272
  }
1273
 
@@ -1279,7 +1279,7 @@ class wpForoAction {
1279
 
1280
  if(!WPF()->perm->usergroup_can('ms')){
1281
  WPF()->notice->add('Permission denied', 'error');
1282
- wp_redirect(admin_url());
1283
  exit();
1284
  }
1285
 
@@ -1300,12 +1300,13 @@ class wpForoAction {
1300
 
1301
  if(!WPF()->perm->usergroup_can('ms')){
1302
  WPF()->notice->add('Permission denied', 'error');
1303
- wp_redirect(admin_url());
1304
  exit();
1305
  }
1306
 
1307
  if( $options = wpfval($_POST, 'wpforo_email_options') ){
1308
  if( !wpfkey( $_POST, 'reset' ) ){
 
1309
  $options['from_name'] = sanitize_text_field( $options['from_name'] );
1310
  $options['from_email'] = sanitize_text_field( $options['from_email'] );
1311
  $options['admin_emails'] = sanitize_text_field( $options['admin_emails'] );
@@ -1342,7 +1343,7 @@ class wpForoAction {
1342
  wpforo_clean_cache();
1343
  }
1344
 
1345
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=emails' ) );
1346
  exit();
1347
  }
1348
 
@@ -1354,7 +1355,7 @@ class wpForoAction {
1354
 
1355
  if(!WPF()->perm->usergroup_can('mt')){
1356
  WPF()->notice->add('Permission denied', 'error');
1357
- wp_redirect(admin_url());
1358
  exit();
1359
  }
1360
 
@@ -1392,7 +1393,7 @@ class wpForoAction {
1392
  WPF()->notice->add( 'Antispam options reset successfully', 'success' );
1393
  }
1394
 
1395
- wp_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=antispam' ) );
1396
  exit();
1397
  }
1398
 
@@ -1404,7 +1405,7 @@ class wpForoAction {
1404
 
1405
  if(!WPF()->perm->usergroup_can('mt')){
1406
  WPF()->notice->add('Permission denied', 'error');
1407
- wp_redirect(admin_url());
1408
  exit();
1409
  }
1410
 
@@ -1419,7 +1420,7 @@ class wpForoAction {
1419
  WPF()->notice->add( 'Cleanup options reset successfully', 'success' );
1420
  }
1421
 
1422
- wp_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=cleanup' ) );
1423
  exit();
1424
  }
1425
 
@@ -1431,7 +1432,7 @@ class wpForoAction {
1431
 
1432
  if(!WPF()->perm->usergroup_can('mt')){
1433
  WPF()->notice->add('Permission denied', 'error');
1434
- wp_redirect(admin_url());
1435
  exit();
1436
  }
1437
 
@@ -1452,7 +1453,7 @@ class wpForoAction {
1452
  WPF()->notice->add( 'Misc options reset successfully', 'success' );
1453
  }
1454
 
1455
- wp_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=misc' ) );
1456
  exit();
1457
  }
1458
 
@@ -1464,7 +1465,7 @@ class wpForoAction {
1464
 
1465
  if(!WPF()->perm->usergroup_can('mt')){
1466
  WPF()->notice->add('Permission denied', 'error');
1467
- wp_redirect(admin_url());
1468
  exit();
1469
  }
1470
 
@@ -1490,7 +1491,7 @@ class wpForoAction {
1490
  WPF()->notice->add( 'Settings reset successfully', 'success' );
1491
  }
1492
 
1493
- wp_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=legal' ) );
1494
  exit();
1495
  }
1496
 
@@ -1502,7 +1503,7 @@ class wpForoAction {
1502
 
1503
  if(!WPF()->perm->usergroup_can('mt')){
1504
  WPF()->notice->add('Permission denied', 'error');
1505
- wp_redirect(admin_url());
1506
  exit();
1507
  }
1508
 
@@ -1521,7 +1522,7 @@ class wpForoAction {
1521
  }
1522
  }
1523
 
1524
- wp_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=antispam' ) );
1525
  exit();
1526
  }
1527
 
@@ -1533,7 +1534,7 @@ class wpForoAction {
1533
 
1534
  if(!WPF()->perm->usergroup_can('mt')){
1535
  WPF()->notice->add('Permission denied', 'error');
1536
- wp_redirect(admin_url());
1537
  exit();
1538
  }
1539
 
@@ -1559,7 +1560,7 @@ class wpForoAction {
1559
  }
1560
  }
1561
 
1562
- wp_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=antispam' ) );
1563
  exit();
1564
  }
1565
 
@@ -1571,7 +1572,7 @@ class wpForoAction {
1571
 
1572
  if(!WPF()->perm->usergroup_can('mt')){
1573
  WPF()->notice->add('Permission denied', 'error');
1574
- wp_redirect(admin_url());
1575
  exit();
1576
  }
1577
 
@@ -1579,7 +1580,7 @@ class wpForoAction {
1579
 
1580
  wpforo_update_db();
1581
 
1582
- wp_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=debug&view=tables' ) );
1583
  exit();
1584
  }
1585
 
@@ -1591,7 +1592,7 @@ class wpForoAction {
1591
 
1592
  if( !WPF()->forum->manage() ){
1593
  WPF()->notice->add('Permission denied', 'error');
1594
- wp_redirect(admin_url());
1595
  exit();
1596
  }
1597
 
@@ -1599,7 +1600,7 @@ class wpForoAction {
1599
  WPF()->forum->add();
1600
  }
1601
 
1602
- wp_redirect( admin_url( 'admin.php?page=wpforo-forums' ) );
1603
  exit();
1604
  }
1605
 
@@ -1611,7 +1612,7 @@ class wpForoAction {
1611
 
1612
  if( !WPF()->forum->manage() ){
1613
  WPF()->notice->add('Permission denied', 'error');
1614
- wp_redirect(admin_url());
1615
  exit();
1616
  }
1617
 
@@ -1619,7 +1620,7 @@ class wpForoAction {
1619
  WPF()->forum->edit();
1620
  }
1621
 
1622
- wp_redirect( wpforo_get_request_uri() );
1623
  exit();
1624
  }
1625
 
@@ -1631,7 +1632,7 @@ class wpForoAction {
1631
 
1632
  if( !WPF()->forum->manage() ){
1633
  WPF()->notice->add('Permission denied', 'error');
1634
- wp_redirect(admin_url());
1635
  exit();
1636
  }
1637
 
@@ -1642,7 +1643,7 @@ class wpForoAction {
1642
  WPF()->forum->merge();
1643
  }
1644
 
1645
- wp_redirect( admin_url( 'admin.php?page=wpforo-forums' ) );
1646
  exit();
1647
  }
1648
 
@@ -1654,7 +1655,7 @@ class wpForoAction {
1654
 
1655
  if( !WPF()->forum->manage() ){
1656
  WPF()->notice->add('Permission denied', 'error');
1657
- wp_redirect(admin_url());
1658
  exit();
1659
  }
1660
 
@@ -1663,7 +1664,7 @@ class wpForoAction {
1663
  wpforo_clean_cache('forum');
1664
  }
1665
 
1666
- wp_redirect( admin_url( 'admin.php?page=wpforo-forums' ) );
1667
  exit();
1668
  }
1669
 
@@ -1676,7 +1677,7 @@ class wpForoAction {
1676
 
1677
  if(!WPF()->perm->usergroup_can('aum')){
1678
  WPF()->notice->add('Permission denied', 'error');
1679
- wp_redirect(admin_url());
1680
  exit();
1681
  }
1682
 
@@ -1696,7 +1697,7 @@ class wpForoAction {
1696
 
1697
  if(!WPF()->perm->usergroup_can('aum')){
1698
  WPF()->notice->add('Permission denied', 'error');
1699
- wp_redirect(admin_url());
1700
  exit();
1701
  }
1702
 
@@ -1716,7 +1717,7 @@ class wpForoAction {
1716
 
1717
  if(!WPF()->perm->usergroup_can('aum')){
1718
  WPF()->notice->add('Permission denied', 'error');
1719
- wp_redirect(admin_url());
1720
  exit();
1721
  }
1722
 
@@ -1734,7 +1735,7 @@ class wpForoAction {
1734
 
1735
  if(!WPF()->perm->usergroup_can('aum')){
1736
  WPF()->notice->add('Permission denied', 'error');
1737
- wp_redirect(admin_url());
1738
  exit();
1739
  }
1740
 
@@ -1783,7 +1784,7 @@ class wpForoAction {
1783
 
1784
  if(!WPF()->perm->usergroup_can('mp')){
1785
  WPF()->notice->add('Permission denied', 'error');
1786
- wp_redirect(admin_url());
1787
  exit();
1788
  }
1789
 
@@ -1791,7 +1792,7 @@ class wpForoAction {
1791
  WPF()->phrase->add();
1792
  }
1793
 
1794
- wp_redirect( admin_url( 'admin.php?page=wpforo-phrases' ) );
1795
  exit();
1796
  }
1797
 
@@ -1801,7 +1802,7 @@ class wpForoAction {
1801
  public function phrase_edit_form(){
1802
  $phraseids = array_filter( array_map('intval', array_merge((array) wpfval($_GET, 'phraseid'), (array) wpfval($_GET, 'phraseids')) ) );
1803
  if( !$phraseids ){
1804
- wp_redirect( admin_url( 'admin.php?page=wpforo-phrases' ) );
1805
  exit();
1806
  }
1807
  }
@@ -1814,7 +1815,7 @@ class wpForoAction {
1814
 
1815
  if(!WPF()->perm->usergroup_can('mp')){
1816
  WPF()->notice->add('Permission denied', 'error');
1817
- wp_redirect(admin_url());
1818
  exit();
1819
  }
1820
 
@@ -1822,7 +1823,7 @@ class wpForoAction {
1822
  WPF()->phrase->edit();
1823
  }
1824
 
1825
- wp_redirect( admin_url( 'admin.php?page=wpforo-phrases' ) );
1826
  exit();
1827
  }
1828
 
@@ -1835,7 +1836,7 @@ class wpForoAction {
1835
 
1836
  if( !WPF()->perm->usergroup_can('vm') || !WPF()->perm->usergroup_can('bm') || intval($userid) === intval(WPF()->current_userid) ){
1837
  WPF()->notice->add('Permission denied', 'error');
1838
- wp_redirect(admin_url());
1839
  exit();
1840
  }
1841
 
@@ -1855,7 +1856,7 @@ class wpForoAction {
1855
 
1856
  if( !WPF()->perm->usergroup_can('vm') || !WPF()->perm->usergroup_can('bm') || intval($userid) === intval(WPF()->current_userid) ){
1857
  WPF()->notice->add('Permission denied', 'error');
1858
- wp_redirect(admin_url());
1859
  exit();
1860
  }
1861
 
@@ -1888,7 +1889,7 @@ class wpForoAction {
1888
 
1889
  if( !WPF()->perm->usergroup_can('vm') ){
1890
  WPF()->notice->add('Permission denied', 'error');
1891
- wp_redirect(admin_url());
1892
  exit();
1893
  }
1894
 
@@ -1902,11 +1903,11 @@ class wpForoAction {
1902
  $u_action = $this->get_current_bulk_action();
1903
  if( in_array($u_action, array('ban', 'unban')) && !WPF()->perm->usergroup_can('bm') ){
1904
  WPF()->notice->add('Permission denied', 'error');
1905
- wp_redirect(admin_url());
1906
  exit();
1907
  }elseif ( $u_action === 'delete' && !WPF()->perm->usergroup_can('dm') ){
1908
  WPF()->notice->add('Permission denied', 'error');
1909
- wp_redirect(admin_url());
1910
  exit();
1911
  }
1912
 
@@ -1917,7 +1918,7 @@ class wpForoAction {
1917
  if ($u_action === 'delete') {
1918
  $url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) );
1919
  $url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
1920
- wp_redirect( $url );
1921
  exit();
1922
  } elseif ($u_action === 'ban') {
1923
  foreach($userids as $userid) {
@@ -1951,7 +1952,7 @@ class wpForoAction {
1951
 
1952
  if(!WPF()->perm->usergroup_can('vmg')){
1953
  WPF()->notice->add('Permission denied', 'error');
1954
- wp_redirect(admin_url());
1955
  exit();
1956
  }
1957
 
@@ -1962,7 +1963,7 @@ class wpForoAction {
1962
  if($groupid) wpforo_clean_cache( 'loop', $groupid );
1963
  }
1964
 
1965
- wp_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
1966
  exit();
1967
  }
1968
 
@@ -1974,7 +1975,7 @@ class wpForoAction {
1974
 
1975
  if(!WPF()->perm->usergroup_can('vmg')){
1976
  WPF()->notice->add('Permission denied', 'error');
1977
- wp_redirect(admin_url());
1978
  exit();
1979
  }
1980
 
@@ -1985,7 +1986,7 @@ class wpForoAction {
1985
  wpforo_clean_cache( 'loop', $group['groupid'] );
1986
  }
1987
 
1988
- wp_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
1989
  exit();
1990
  }
1991
 
@@ -1997,7 +1998,7 @@ class wpForoAction {
1997
 
1998
  if(!WPF()->perm->usergroup_can('vmg')){
1999
  WPF()->notice->add('Permission denied', 'error');
2000
- wp_redirect(admin_url());
2001
  exit();
2002
  }
2003
 
@@ -2006,7 +2007,7 @@ class wpForoAction {
2006
  if( $userids = WPF()->member->get_userids($args) ){
2007
  $redirect_to = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) );
2008
  $redirect_to = str_replace( '&amp;', '&', wp_nonce_url($redirect_to, 'bulk-users') );
2009
- wp_redirect($redirect_to);
2010
  exit();
2011
  }
2012
  }
@@ -2016,7 +2017,7 @@ class wpForoAction {
2016
  wpforo_clean_cache('user');
2017
  }
2018
 
2019
- wp_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
2020
  exit();
2021
  }
2022
 
@@ -2029,13 +2030,13 @@ class wpForoAction {
2029
 
2030
  if(!WPF()->perm->usergroup_can('vmg')){
2031
  WPF()->notice->add('Permission denied', 'error');
2032
- wp_redirect(admin_url());
2033
  exit();
2034
  }
2035
 
2036
  if($default_groupid) update_option('wpforo_default_groupid', $default_groupid);
2037
 
2038
- wp_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
2039
  exit();
2040
  }
2041
 
@@ -2044,7 +2045,7 @@ class wpForoAction {
2044
  */
2045
  public function usergroup_delete_form() {
2046
  if( intval(wpfval($_GET, 'groupid')) <= 5 ){
2047
- wp_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
2048
  exit();
2049
  }
2050
  }
@@ -2057,7 +2058,7 @@ class wpForoAction {
2057
 
2058
  if(!WPF()->perm->usergroup_can('ms')){
2059
  WPF()->notice->add('Permission denied', 'error');
2060
- wp_redirect(admin_url());
2061
  exit();
2062
  }
2063
 
@@ -2065,7 +2066,7 @@ class wpForoAction {
2065
  WPF()->perm->add( WPF()->perm->fix_access($_POST['access']) );
2066
  }
2067
 
2068
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=accesses' ) );
2069
  exit();
2070
  }
2071
 
@@ -2077,7 +2078,7 @@ class wpForoAction {
2077
 
2078
  if(!WPF()->perm->usergroup_can('ms')){
2079
  WPF()->notice->add('Permission denied', 'error');
2080
- wp_redirect(admin_url());
2081
  exit();
2082
  }
2083
 
@@ -2086,7 +2087,7 @@ class wpForoAction {
2086
  wpforo_clean_cache('loop');
2087
  }
2088
 
2089
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=accesses' ) );
2090
  exit();
2091
  }
2092
 
@@ -2099,14 +2100,14 @@ class wpForoAction {
2099
 
2100
  if(!WPF()->perm->usergroup_can('ms')){
2101
  WPF()->notice->add('Permission denied', 'error');
2102
- wp_redirect(admin_url());
2103
  exit();
2104
  }
2105
 
2106
  WPF()->perm->delete($accessid);
2107
  wpforo_clean_cache( 'loop' );
2108
 
2109
- wp_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=accesses' ) );
2110
  exit();
2111
  }
2112
 
@@ -2118,7 +2119,7 @@ class wpForoAction {
2118
 
2119
  if(!WPF()->perm->usergroup_can('mth')){
2120
  WPF()->notice->add('Permission denied', 'error');
2121
- wp_redirect(admin_url());
2122
  exit();
2123
  }
2124
 
@@ -2138,7 +2139,7 @@ class wpForoAction {
2138
  }
2139
 
2140
  WPF()->notice->add($notice, $notice_type);
2141
- wp_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2142
  exit();
2143
  }
2144
 
@@ -2150,7 +2151,7 @@ class wpForoAction {
2150
 
2151
  if(!WPF()->perm->usergroup_can('mth')){
2152
  WPF()->notice->add('Permission denied', 'error');
2153
- wp_redirect(admin_url());
2154
  exit();
2155
  }
2156
 
@@ -2170,7 +2171,7 @@ class wpForoAction {
2170
  }
2171
 
2172
  WPF()->notice->add($notice, $notice_type);
2173
- wp_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2174
  exit();
2175
  }
2176
 
@@ -2182,7 +2183,7 @@ class wpForoAction {
2182
 
2183
  if(!WPF()->perm->usergroup_can('mth')){
2184
  WPF()->notice->add('Permission denied', 'error');
2185
- wp_redirect(admin_url());
2186
  exit();
2187
  }
2188
 
@@ -2201,7 +2202,7 @@ class wpForoAction {
2201
  }
2202
 
2203
  WPF()->notice->add($notice, $notice_type);
2204
- wp_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2205
  exit();
2206
  }
2207
 
@@ -2213,7 +2214,7 @@ class wpForoAction {
2213
 
2214
  if(!WPF()->perm->usergroup_can('mth')){
2215
  WPF()->notice->add('Permission denied', 'error');
2216
- wp_redirect(admin_url());
2217
  exit();
2218
  }
2219
 
@@ -2231,7 +2232,7 @@ class wpForoAction {
2231
  }
2232
 
2233
  WPF()->notice->add($notice, $notice_type);
2234
- wp_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2235
  exit();
2236
  }
2237
 
@@ -2241,7 +2242,7 @@ class wpForoAction {
2241
  function update_addons_css(){
2242
  check_admin_referer('wpforo-update-addons-css');
2243
  wpforo_wrap_in_all_addons_css();
2244
- wp_redirect( admin_url( 'admin.php?page=wpforo-community' ) );
2245
  exit();
2246
  }
2247
 
@@ -2253,7 +2254,7 @@ class wpForoAction {
2253
  WPF()->dissmissed['poll_version_is_old'] = 1;
2254
  update_option('wpforo_dissmissed', WPF()->dissmissed);
2255
  wpforo_clean_cache('option');
2256
- wp_redirect( admin_url( 'admin.php?page=wpforo-community' ) );
2257
  exit();
2258
  }
2259
 
220
  $topic['topicurl'] = wpforo_home_url();
221
  } else {
222
  $topic = wpforo_topic( $topicid );
223
+ $topic['topicurl'] = ( wpfval($topic, 'url') ) ? $topic['url'] : WPF()->topic->get_topic_url( $topicid );
224
  $posts = WPF()->post->get_posts( array(
225
  'topicid' => $topicid,
226
  'row_count' => $topic_rss_items,
299
  WPF()->log->mark_all_read();
300
  $current_url = wpforo_get_request_uri();
301
  $current_url = strtok( $current_url, '?');
302
+ wp_safe_redirect($current_url);
303
  exit();
304
  }
305
  }
328
  WPF()->activity->read_notification( $id );
329
  $current_url = wpforo_get_request_uri();
330
  $current_url = strtok( $current_url, '?');
331
+ wp_safe_redirect($current_url);
332
  exit();
333
  }
334
  }
355
  WPF()->member->reset($userid);
356
  if( WPF()->member->options['redirect_url_after_register'] ){
357
  $redirect_url = WPF()->member->options['redirect_url_after_register'];
358
+ }elseif( ($redirect_to = wpfval($_GET, 'redirect_to')) && wpforo_is_url_internal(urldecode($redirect_to)) ){
359
  $redirect_url = urldecode($redirect_to);
360
  }elseif( is_wpforo_url() ){
361
  $redirect_url = preg_replace('#\?.*$#is', '', wpforo_get_request_uri());
363
  $redirect_url = ( wpforo_feature('user-register-email-confirm') ? wpforo_home_url() : WPF()->member->get_profile_url( $userid, 'account' ) );
364
  }
365
 
366
+ wp_safe_redirect($redirect_url);
367
  exit();
368
  }
369
  }
388
  update_user_meta( $user->ID, '_wpf_login_times', $wpf_login_times );
389
  if( WPF()->member->options['redirect_url_after_login'] ){
390
  $redirect_url = WPF()->member->options['redirect_url_after_login'];
391
+ }elseif( ($redirect_to = wpfval($_GET, 'redirect_to')) && wpforo_is_url_internal(urldecode($redirect_to)) ){
392
  $redirect_url = urldecode($redirect_to);
393
  }elseif( is_wpforo_url() ){
394
  $redirect_url = preg_replace('#\?.*$#is', '', wpforo_get_request_uri());
395
  }else{
396
  $redirect_url = wpforo_home_url();
397
  }
398
+ wp_safe_redirect($redirect_url);
 
399
  }else{
400
  $args = array();
401
  foreach($user->errors as $u_err) $args[] = $u_err[0];
402
  WPF()->notice->add($args, 'error');
403
+ wp_safe_redirect( wpforo_get_request_uri() );
 
404
  }
405
+ exit();
406
  }
407
  }
408
 
417
  ( WPF()->perm->usergroup_can('em') && WPF()->perm->user_can_manage_user( WPF()->current_userid, $uid )) ) ){
418
  WPF()->notice->clear();
419
  WPF()->notice->add('Permission denied', 'error');
420
+ wp_safe_redirect(wpforo_get_request_uri());
421
  exit();
422
  }
423
  if( $user = WPF()->member->update($_POST) ){
424
  if( $profile_url = WPF()->member->get_profile_url( $uid, 'account') ){
425
+ wp_safe_redirect($profile_url);
426
  exit();
427
  }
428
  }
429
  }
430
 
431
+ wp_safe_redirect(wpforo_get_request_uri());
432
  exit();
433
  }
434
 
440
  $args = $_REQUEST['topic'];
441
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
442
  if( $topicid = WPF()->topic->add($args) ){
443
+ wp_safe_redirect( WPF()->topic->get_topic_url($topicid) );
444
  exit();
445
  }
446
+ wp_safe_redirect( wpforo_get_request_uri() );
447
  exit();
448
  }
449
 
455
  $args = $_REQUEST['topic'];
456
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
457
  if( $topicid = WPF()->topic->edit($args) ){
458
+ wp_safe_redirect( WPF()->topic->get_topic_url($topicid) );
459
  exit();
460
  }
461
+ wp_safe_redirect( wpforo_get_request_uri() );
462
  exit();
463
  }
464
 
470
  $args = $_REQUEST['post'];
471
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
472
  if( $postid = WPF()->post->add($args) ){
473
+ wp_safe_redirect( WPF()->post->get_post_url( $postid ) );
474
  exit();
475
  }
476
+ wp_safe_redirect( wpforo_get_request_uri() );
477
  exit();
478
  }
479
 
485
  $args = $_REQUEST['post'];
486
  $args['postmetas'] = (array) wpfval($_REQUEST, 'data');
487
  if( $postid = WPF()->post->edit($args) ){
488
+ wp_safe_redirect( WPF()->post->get_post_url( $postid ) );
489
  exit();
490
  }
491
+ wp_safe_redirect( wpforo_get_request_uri() );
492
  exit();
493
  }
494
 
502
  $forumid = intval( wpfval($_POST['topic_move'], 'forumid') );
503
  if( $topicid && $forumid ){
504
  WPF()->topic->move($topicid, $forumid);
505
+ wp_safe_redirect( WPF()->topic->get_topic_url($topicid) );
506
  exit();
507
  }
508
  }
509
 
510
+ wp_safe_redirect( wpforo_get_request_uri() );
511
  exit();
512
  }
513
 
529
  WPF()->notice->add('Target Topic not found', 'error');
530
  }
531
  }
532
+ wp_safe_redirect($redirect_to);
533
  exit();
534
  }
535
 
564
  }
565
  }
566
  }
567
+ wp_safe_redirect($redirect_to);
568
  exit();
569
  }
570
 
577
  WPF()->sbscrb->edit($sbs_key);
578
  $redirect_url = wpforo_home_url( preg_replace('#\?.*$#is', '', WPF()->current_url) );
579
  if( WPF()->member->options['redirect_url_after_confirm_sbscrb'] ) $redirect_url = WPF()->member->options['redirect_url_after_confirm_sbscrb'];
580
+ wp_safe_redirect($redirect_url);
581
  exit();
582
  }
583
  }
591
  WPF()->sbscrb->delete($sbs_key);
592
  $redirect_url = wpforo_home_url( preg_replace('#\?.*$#is', '', WPF()->current_url) );
593
  if( WPF()->member->options['redirect_url_after_confirm_sbscrb'] ) $redirect_url = WPF()->member->options['redirect_url_after_confirm_sbscrb'];
594
+ wp_safe_redirect($redirect_url);
595
  exit();
596
  }
597
  }
600
  * subscribe_manager form submit action
601
  */
602
  public function subscribe_manager(){
603
+ wpforo_verify_form();
604
  $data = ( !empty($_POST['wpforo']['forums']) ? array_map( 'sanitize_title', $_POST['wpforo']['forums'] ) : array() );
605
  $all = ( !empty($_POST['wpforo']['check_all']) ? sanitize_title($_POST['wpforo']['check_all']) : '' );
606
 
607
+ WPF()->sbscrb->reset($data, $all, (int) wpfval( $_POST, 'wpforo', 'userid' ));
608
+ wp_safe_redirect( wpforo_get_request_uri() );
609
  exit();
610
  }
611
 
617
 
618
  if(!current_user_can('administrator')){
619
  WPF()->notice->add('Permission denied', 'error');
620
+ wp_safe_redirect(admin_url());
621
  exit();
622
  }
623
 
629
  WPF()->member->clear_db_cache();
630
  wpforo_clean_cache();
631
  WPF()->notice->add('Synched Successfully!', 'success');
632
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
633
  }else{
634
+ wp_safe_redirect( htmlspecialchars_decode( wp_nonce_url( admin_url( 'admin.php?page=wpforo-community&wpfaction=wpforo_synch_user_profiles' ), 'wpforo_synch_user_profiles' ) ) );
635
  }
636
  exit();
637
  }
645
 
646
  if(!current_user_can('administrator')){
647
  WPF()->notice->add('Permission denied', 'error');
648
+ wp_safe_redirect(admin_url());
649
  exit();
650
  }
651
 
655
  WPF()->member->clear_db_cache();
656
  WPF()->notice->add('Deleted Successfully!', 'success');
657
 
658
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
659
  exit();
660
  }
661
 
667
 
668
  if(!current_user_can('administrator')){
669
  WPF()->notice->add('Permission denied', 'error');
670
+ wp_safe_redirect(admin_url());
671
  exit();
672
  }
673
 
684
  WPF()->notice->add('Updated Successfully!', 'success');
685
  }
686
 
687
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
688
  exit();
689
  }
690
 
696
 
697
  if(!current_user_can('administrator')){
698
  WPF()->notice->add('Permission denied', 'error');
699
+ wp_safe_redirect(admin_url());
700
  exit();
701
  }
702
 
713
  WPF()->topic->rebuild_first_last($topic);
714
  WPF()->topic->rebuild_stats($topic);
715
  }
716
+ wp_safe_redirect( htmlspecialchars_decode( wp_nonce_url( admin_url( 'admin.php?page=wpforo-community&wpfaction=wpforo_reset_topics_stats&topic_lastid=' . end($topicids) ), 'wpforo_reset_topics_stat' ) ) );
717
  }else{
718
  @WPF()->db->query( "UPDATE `".WPF()->tables->topics."` t
719
  INNER JOIN `".WPF()->tables->posts."` p ON p.`topicid` = t.`topicid` AND p.`is_answer` = 1
721
  WHERE t.`solved` = 0" );
722
  WPF()->db->query("DELETE FROM `" . WPF()->db->options."` WHERE `option_name` LIKE 'wpforo_stat%'" );
723
  WPF()->notice->add('Updated Successfully!', 'success');
724
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
725
  }
726
  exit();
727
  }
735
 
736
  if(!current_user_can('administrator')){
737
  WPF()->notice->add('Permission denied', 'error');
738
+ wp_safe_redirect(admin_url());
739
  exit();
740
  }
741
 
766
  );
767
  }
768
 
769
+ wp_safe_redirect( htmlspecialchars_decode( wp_nonce_url( admin_url( 'admin.php?page=wpforo-community&wpfaction=wpforo_reset_users_stats&user_lastid=' . end($userids) ), 'wpforo_reset_users_stat' ) ) );
770
  }else{
771
  WPF()->notice->add('Updated Successfully!', 'success');
772
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
773
  }
774
  exit();
775
  }
783
 
784
  if(!current_user_can('administrator')){
785
  WPF()->notice->add('Permission denied', 'error');
786
+ wp_safe_redirect(admin_url());
787
  exit();
788
  }
789
 
794
  wpforo_clean_cache();
795
  WPF()->notice->add('Threads rebuilt successfully', 'success');
796
 
797
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
798
  exit();
799
  }
800
 
806
 
807
  if(!current_user_can('administrator')){
808
  WPF()->notice->add('Permission denied', 'error');
809
+ wp_safe_redirect(admin_url());
810
  exit();
811
  }
812
 
816
  WPF()->phrase->clear_cache();
817
  WPF()->notice->add('Deleted Successfully!', 'success');
818
 
819
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
820
  exit();
821
  }
822
 
828
 
829
  if(!current_user_can('administrator')){
830
  WPF()->notice->add('Permission denied', 'error');
831
+ wp_safe_redirect(admin_url());
832
  exit();
833
  }
834
 
840
  WPF()->notice->clear();
841
  WPF()->notice->add('Rebuilt Successfully!', 'success');
842
 
843
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
844
  exit();
845
  }
846
 
852
 
853
  if(!current_user_can('administrator')){
854
  WPF()->notice->add('Permission denied', 'error');
855
+ wp_safe_redirect(admin_url());
856
  exit();
857
  }
858
 
865
  WPF()->notice->add('Deleted Successfully!', 'success');
866
 
867
  $redirect = ( is_admin() ) ? admin_url('admin.php?page=wpforo-community') : wpforo_home_url();
868
+ wp_safe_redirect( $redirect );
869
  exit();
870
  }
871
 
877
 
878
  if(!current_user_can('administrator')){
879
  WPF()->notice->add('Permission denied', 'error');
880
+ wp_safe_redirect(admin_url());
881
  exit();
882
  }
883
 
887
  wpforo_clean_up();
888
  WPF()->notice->add('Cleaned Up!', 'success');
889
 
890
+ wp_safe_redirect(admin_url('admin.php?page=wpforo-community'));
891
  exit();
892
  }
893
 
897
  public function dashboard_options_save(){
898
  if(!current_user_can('administrator')){
899
  WPF()->notice->add('Permission denied', 'error');
900
+ wp_safe_redirect(admin_url());
901
  exit();
902
  }
903
  if( $dashboard_count_per_page = (int) wpfval($_POST, 'wpforo_dashboard_count_per_page') ){
904
  update_option('wpforo_count_per_page', $dashboard_count_per_page );
905
  }
906
+ wp_safe_redirect( wpforo_get_request_uri() );
907
  exit();
908
  }
909
 
915
  if( $page === 'wpforo-settings' ){
916
  if(!WPF()->perm->usergroup_can('ms')){
917
  WPF()->notice->add('Permission denied', 'error');
918
+ wp_safe_redirect(admin_url());
919
  exit();
920
  }
921
  }
945
 
946
  if(!WPF()->perm->usergroup_can('ms')){
947
  WPF()->notice->add('Permission denied', 'error');
948
+ wp_safe_redirect(admin_url());
949
  exit();
950
  }
951
 
1021
 
1022
  WPF()->member->clear_db_cache();
1023
  wpforo_clean_cache();
1024
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=general' ) );
1025
  exit();
1026
  }
1027
 
1033
 
1034
  if(!WPF()->perm->usergroup_can('ms')){
1035
  WPF()->notice->add('Permission denied', 'error');
1036
+ wp_safe_redirect(admin_url());
1037
  exit();
1038
  }
1039
 
1041
  WPF()->phrase->add_lang();
1042
  wpforo_clean_cache();
1043
  }
1044
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=general' ) );
1045
  exit();
1046
  }
1047
 
1053
 
1054
  if(!WPF()->perm->usergroup_can('ms')){
1055
  WPF()->notice->add('Permission denied', 'error');
1056
+ wp_safe_redirect(admin_url());
1057
  exit();
1058
  }
1059
 
1071
 
1072
  wpforo_clean_cache();
1073
  }
1074
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=forums' ) );
1075
  exit();
1076
  }
1077
 
1083
 
1084
  if( !WPF()->perm->usergroup_can('ms') ){
1085
  WPF()->notice->add('Permission denied', 'error');
1086
+ wp_safe_redirect(admin_url());
1087
  exit();
1088
  }
1089
 
1109
  wpforo_clean_cache();
1110
  }
1111
 
1112
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=posts' ) );
1113
  exit();
1114
  }
1115
 
1122
 
1123
  if(!WPF()->perm->usergroup_can('ms')){
1124
  WPF()->notice->add('Permission denied', 'error');
1125
+ wp_safe_redirect(admin_url());
1126
  exit();
1127
  }
1128
 
1165
  wpforo_clean_cache();
1166
  }
1167
 
1168
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=members' ) );
1169
  exit();
1170
  }
1171
 
1177
 
1178
  if(!WPF()->perm->usergroup_can('ms')){
1179
  WPF()->notice->add('Permission denied', 'error');
1180
+ wp_safe_redirect(admin_url());
1181
  exit();
1182
  }
1183
 
1196
  WPF()->seo->clear_cache();
1197
  }
1198
 
1199
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=features' ) );
1200
  exit();
1201
  }
1202
 
1208
 
1209
  if(!WPF()->perm->usergroup_can('ms')){
1210
  WPF()->notice->add('Permission denied', 'error');
1211
+ wp_safe_redirect(admin_url());
1212
  exit();
1213
  }
1214
 
1225
  }
1226
  }
1227
 
1228
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=api' ) );
1229
  exit();
1230
  }
1231
 
1237
 
1238
  if(!WPF()->perm->usergroup_can('ms')){
1239
  WPF()->notice->add('Permission denied', 'error');
1240
+ wp_safe_redirect(admin_url());
1241
  exit();
1242
  }
1243
 
1267
  wpforo_clean_cache();
1268
  }
1269
 
1270
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=styles' ) );
1271
  exit();
1272
  }
1273
 
1279
 
1280
  if(!WPF()->perm->usergroup_can('ms')){
1281
  WPF()->notice->add('Permission denied', 'error');
1282
+ wp_safe_redirect(admin_url());
1283
  exit();
1284
  }
1285
 
1300
 
1301
  if(!WPF()->perm->usergroup_can('ms')){
1302
  WPF()->notice->add('Permission denied', 'error');
1303
+ wp_safe_redirect(admin_url());
1304
  exit();
1305
  }
1306
 
1307
  if( $options = wpfval($_POST, 'wpforo_email_options') ){
1308
  if( !wpfkey( $_POST, 'reset' ) ){
1309
+ $options = wp_unslash($options);
1310
  $options['from_name'] = sanitize_text_field( $options['from_name'] );
1311
  $options['from_email'] = sanitize_text_field( $options['from_email'] );
1312
  $options['admin_emails'] = sanitize_text_field( $options['admin_emails'] );
1343
  wpforo_clean_cache();
1344
  }
1345
 
1346
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=emails' ) );
1347
  exit();
1348
  }
1349
 
1355
 
1356
  if(!WPF()->perm->usergroup_can('mt')){
1357
  WPF()->notice->add('Permission denied', 'error');
1358
+ wp_safe_redirect(admin_url());
1359
  exit();
1360
  }
1361
 
1393
  WPF()->notice->add( 'Antispam options reset successfully', 'success' );
1394
  }
1395
 
1396
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=antispam' ) );
1397
  exit();
1398
  }
1399
 
1405
 
1406
  if(!WPF()->perm->usergroup_can('mt')){
1407
  WPF()->notice->add('Permission denied', 'error');
1408
+ wp_safe_redirect(admin_url());
1409
  exit();
1410
  }
1411
 
1420
  WPF()->notice->add( 'Cleanup options reset successfully', 'success' );
1421
  }
1422
 
1423
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=cleanup' ) );
1424
  exit();
1425
  }
1426
 
1432
 
1433
  if(!WPF()->perm->usergroup_can('mt')){
1434
  WPF()->notice->add('Permission denied', 'error');
1435
+ wp_safe_redirect(admin_url());
1436
  exit();
1437
  }
1438
 
1453
  WPF()->notice->add( 'Misc options reset successfully', 'success' );
1454
  }
1455
 
1456
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=misc' ) );
1457
  exit();
1458
  }
1459
 
1465
 
1466
  if(!WPF()->perm->usergroup_can('mt')){
1467
  WPF()->notice->add('Permission denied', 'error');
1468
+ wp_safe_redirect(admin_url());
1469
  exit();
1470
  }
1471
 
1491
  WPF()->notice->add( 'Settings reset successfully', 'success' );
1492
  }
1493
 
1494
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=legal' ) );
1495
  exit();
1496
  }
1497
 
1503
 
1504
  if(!WPF()->perm->usergroup_can('mt')){
1505
  WPF()->notice->add('Permission denied', 'error');
1506
+ wp_safe_redirect(admin_url());
1507
  exit();
1508
  }
1509
 
1522
  }
1523
  }
1524
 
1525
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=antispam' ) );
1526
  exit();
1527
  }
1528
 
1534
 
1535
  if(!WPF()->perm->usergroup_can('mt')){
1536
  WPF()->notice->add('Permission denied', 'error');
1537
+ wp_safe_redirect(admin_url());
1538
  exit();
1539
  }
1540
 
1560
  }
1561
  }
1562
 
1563
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=antispam' ) );
1564
  exit();
1565
  }
1566
 
1572
 
1573
  if(!WPF()->perm->usergroup_can('mt')){
1574
  WPF()->notice->add('Permission denied', 'error');
1575
+ wp_safe_redirect(admin_url());
1576
  exit();
1577
  }
1578
 
1580
 
1581
  wpforo_update_db();
1582
 
1583
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-tools&tab=debug&view=tables' ) );
1584
  exit();
1585
  }
1586
 
1592
 
1593
  if( !WPF()->forum->manage() ){
1594
  WPF()->notice->add('Permission denied', 'error');
1595
+ wp_safe_redirect(admin_url());
1596
  exit();
1597
  }
1598
 
1600
  WPF()->forum->add();
1601
  }
1602
 
1603
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-forums' ) );
1604
  exit();
1605
  }
1606
 
1612
 
1613
  if( !WPF()->forum->manage() ){
1614
  WPF()->notice->add('Permission denied', 'error');
1615
+ wp_safe_redirect(admin_url());
1616
  exit();
1617
  }
1618
 
1620
  WPF()->forum->edit();
1621
  }
1622
 
1623
+ wp_safe_redirect( wpforo_get_request_uri() );
1624
  exit();
1625
  }
1626
 
1632
 
1633
  if( !WPF()->forum->manage() ){
1634
  WPF()->notice->add('Permission denied', 'error');
1635
+ wp_safe_redirect(admin_url());
1636
  exit();
1637
  }
1638
 
1643
  WPF()->forum->merge();
1644
  }
1645
 
1646
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-forums' ) );
1647
  exit();
1648
  }
1649
 
1655
 
1656
  if( !WPF()->forum->manage() ){
1657
  WPF()->notice->add('Permission denied', 'error');
1658
+ wp_safe_redirect(admin_url());
1659
  exit();
1660
  }
1661
 
1664
  wpforo_clean_cache('forum');
1665
  }
1666
 
1667
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-forums' ) );
1668
  exit();
1669
  }
1670
 
1677
 
1678
  if(!WPF()->perm->usergroup_can('aum')){
1679
  WPF()->notice->add('Permission denied', 'error');
1680
+ wp_safe_redirect(admin_url());
1681
  exit();
1682
  }
1683
 
1697
 
1698
  if(!WPF()->perm->usergroup_can('aum')){
1699
  WPF()->notice->add('Permission denied', 'error');
1700
+ wp_safe_redirect(admin_url());
1701
  exit();
1702
  }
1703
 
1717
 
1718
  if(!WPF()->perm->usergroup_can('aum')){
1719
  WPF()->notice->add('Permission denied', 'error');
1720
+ wp_safe_redirect(admin_url());
1721
  exit();
1722
  }
1723
 
1735
 
1736
  if(!WPF()->perm->usergroup_can('aum')){
1737
  WPF()->notice->add('Permission denied', 'error');
1738
+ wp_safe_redirect(admin_url());
1739
  exit();
1740
  }
1741
 
1784
 
1785
  if(!WPF()->perm->usergroup_can('mp')){
1786
  WPF()->notice->add('Permission denied', 'error');
1787
+ wp_safe_redirect(admin_url());
1788
  exit();
1789
  }
1790
 
1792
  WPF()->phrase->add();
1793
  }
1794
 
1795
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-phrases' ) );
1796
  exit();
1797
  }
1798
 
1802
  public function phrase_edit_form(){
1803
  $phraseids = array_filter( array_map('intval', array_merge((array) wpfval($_GET, 'phraseid'), (array) wpfval($_GET, 'phraseids')) ) );
1804
  if( !$phraseids ){
1805
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-phrases' ) );
1806
  exit();
1807
  }
1808
  }
1815
 
1816
  if(!WPF()->perm->usergroup_can('mp')){
1817
  WPF()->notice->add('Permission denied', 'error');
1818
+ wp_safe_redirect(admin_url());
1819
  exit();
1820
  }
1821
 
1823
  WPF()->phrase->edit();
1824
  }
1825
 
1826
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-phrases' ) );
1827
  exit();
1828
  }
1829
 
1836
 
1837
  if( !WPF()->perm->usergroup_can('vm') || !WPF()->perm->usergroup_can('bm') || intval($userid) === intval(WPF()->current_userid) ){
1838
  WPF()->notice->add('Permission denied', 'error');
1839
+ wp_safe_redirect(admin_url());
1840
  exit();
1841
  }
1842
 
1856
 
1857
  if( !WPF()->perm->usergroup_can('vm') || !WPF()->perm->usergroup_can('bm') || intval($userid) === intval(WPF()->current_userid) ){
1858
  WPF()->notice->add('Permission denied', 'error');
1859
+ wp_safe_redirect(admin_url());
1860
  exit();
1861
  }
1862
 
1889
 
1890
  if( !WPF()->perm->usergroup_can('vm') ){
1891
  WPF()->notice->add('Permission denied', 'error');
1892
+ wp_safe_redirect(admin_url());
1893
  exit();
1894
  }
1895
 
1903
  $u_action = $this->get_current_bulk_action();
1904
  if( in_array($u_action, array('ban', 'unban')) && !WPF()->perm->usergroup_can('bm') ){
1905
  WPF()->notice->add('Permission denied', 'error');
1906
+ wp_safe_redirect(admin_url());
1907
  exit();
1908
  }elseif ( $u_action === 'delete' && !WPF()->perm->usergroup_can('dm') ){
1909
  WPF()->notice->add('Permission denied', 'error');
1910
+ wp_safe_redirect(admin_url());
1911
  exit();
1912
  }
1913
 
1918
  if ($u_action === 'delete') {
1919
  $url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) );
1920
  $url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
1921
+ wp_safe_redirect( $url );
1922
  exit();
1923
  } elseif ($u_action === 'ban') {
1924
  foreach($userids as $userid) {
1952
 
1953
  if(!WPF()->perm->usergroup_can('vmg')){
1954
  WPF()->notice->add('Permission denied', 'error');
1955
+ wp_safe_redirect(admin_url());
1956
  exit();
1957
  }
1958
 
1963
  if($groupid) wpforo_clean_cache( 'loop', $groupid );
1964
  }
1965
 
1966
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
1967
  exit();
1968
  }
1969
 
1975
 
1976
  if(!WPF()->perm->usergroup_can('vmg')){
1977
  WPF()->notice->add('Permission denied', 'error');
1978
+ wp_safe_redirect(admin_url());
1979
  exit();
1980
  }
1981
 
1986
  wpforo_clean_cache( 'loop', $group['groupid'] );
1987
  }
1988
 
1989
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
1990
  exit();
1991
  }
1992
 
1998
 
1999
  if(!WPF()->perm->usergroup_can('vmg')){
2000
  WPF()->notice->add('Permission denied', 'error');
2001
+ wp_safe_redirect(admin_url());
2002
  exit();
2003
  }
2004
 
2007
  if( $userids = WPF()->member->get_userids($args) ){
2008
  $redirect_to = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) );
2009
  $redirect_to = str_replace( '&amp;', '&', wp_nonce_url($redirect_to, 'bulk-users') );
2010
+ wp_safe_redirect($redirect_to);
2011
  exit();
2012
  }
2013
  }
2017
  wpforo_clean_cache('user');
2018
  }
2019
 
2020
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
2021
  exit();
2022
  }
2023
 
2030
 
2031
  if(!WPF()->perm->usergroup_can('vmg')){
2032
  WPF()->notice->add('Permission denied', 'error');
2033
+ wp_safe_redirect(admin_url());
2034
  exit();
2035
  }
2036
 
2037
  if($default_groupid) update_option('wpforo_default_groupid', $default_groupid);
2038
 
2039
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
2040
  exit();
2041
  }
2042
 
2045
  */
2046
  public function usergroup_delete_form() {
2047
  if( intval(wpfval($_GET, 'groupid')) <= 5 ){
2048
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-usergroups' ) );
2049
  exit();
2050
  }
2051
  }
2058
 
2059
  if(!WPF()->perm->usergroup_can('ms')){
2060
  WPF()->notice->add('Permission denied', 'error');
2061
+ wp_safe_redirect(admin_url());
2062
  exit();
2063
  }
2064
 
2066
  WPF()->perm->add( WPF()->perm->fix_access($_POST['access']) );
2067
  }
2068
 
2069
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=accesses' ) );
2070
  exit();
2071
  }
2072
 
2078
 
2079
  if(!WPF()->perm->usergroup_can('ms')){
2080
  WPF()->notice->add('Permission denied', 'error');
2081
+ wp_safe_redirect(admin_url());
2082
  exit();
2083
  }
2084
 
2087
  wpforo_clean_cache('loop');
2088
  }
2089
 
2090
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=accesses' ) );
2091
  exit();
2092
  }
2093
 
2100
 
2101
  if(!WPF()->perm->usergroup_can('ms')){
2102
  WPF()->notice->add('Permission denied', 'error');
2103
+ wp_safe_redirect(admin_url());
2104
  exit();
2105
  }
2106
 
2107
  WPF()->perm->delete($accessid);
2108
  wpforo_clean_cache( 'loop' );
2109
 
2110
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-settings&tab=accesses' ) );
2111
  exit();
2112
  }
2113
 
2119
 
2120
  if(!WPF()->perm->usergroup_can('mth')){
2121
  WPF()->notice->add('Permission denied', 'error');
2122
+ wp_safe_redirect(admin_url());
2123
  exit();
2124
  }
2125
 
2139
  }
2140
 
2141
  WPF()->notice->add($notice, $notice_type);
2142
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2143
  exit();
2144
  }
2145
 
2151
 
2152
  if(!WPF()->perm->usergroup_can('mth')){
2153
  WPF()->notice->add('Permission denied', 'error');
2154
+ wp_safe_redirect(admin_url());
2155
  exit();
2156
  }
2157
 
2171
  }
2172
 
2173
  WPF()->notice->add($notice, $notice_type);
2174
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2175
  exit();
2176
  }
2177
 
2183
 
2184
  if(!WPF()->perm->usergroup_can('mth')){
2185
  WPF()->notice->add('Permission denied', 'error');
2186
+ wp_safe_redirect(admin_url());
2187
  exit();
2188
  }
2189
 
2202
  }
2203
 
2204
  WPF()->notice->add($notice, $notice_type);
2205
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2206
  exit();
2207
  }
2208
 
2214
 
2215
  if(!WPF()->perm->usergroup_can('mth')){
2216
  WPF()->notice->add('Permission denied', 'error');
2217
+ wp_safe_redirect(admin_url());
2218
  exit();
2219
  }
2220
 
2232
  }
2233
 
2234
  WPF()->notice->add($notice, $notice_type);
2235
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-themes' ) );
2236
  exit();
2237
  }
2238
 
2242
  function update_addons_css(){
2243
  check_admin_referer('wpforo-update-addons-css');
2244
  wpforo_wrap_in_all_addons_css();
2245
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-community' ) );
2246
  exit();
2247
  }
2248
 
2254
  WPF()->dissmissed['poll_version_is_old'] = 1;
2255
  update_option('wpforo_dissmissed', WPF()->dissmissed);
2256
  wpforo_clean_cache('option');
2257
+ wp_safe_redirect( admin_url( 'admin.php?page=wpforo-community' ) );
2258
  exit();
2259
  }
2260
 
wpf-includes/class-api.php CHANGED
@@ -656,7 +656,7 @@ class wpForoAPI{
656
  return true;
657
  } else {
658
  WPF()->notice->add( $result , 'error');
659
- wp_redirect( wpforo_get_request_uri() );
660
  exit();
661
  }
662
  }
656
  return true;
657
  } else {
658
  WPF()->notice->add( $result , 'error');
659
+ wp_safe_redirect( wpforo_get_request_uri() );
660
  exit();
661
  }
662
  }
wpf-includes/class-cache.php CHANGED
@@ -48,7 +48,7 @@ class wpForoCache{
48
 
49
  $this->mkdir( $dirs );
50
  }
51
-
52
  private function mkdir( $dirs ){
53
  foreach( $dirs as $dir ){
54
  wp_mkdir_p($dir);
48
 
49
  $this->mkdir( $dirs );
50
  }
51
+
52
  private function mkdir( $dirs ){
53
  foreach( $dirs as $dir ){
54
  wp_mkdir_p($dir);
wpf-includes/class-forms.php CHANGED
@@ -429,7 +429,7 @@ class wpForoForm{
429
  wpforo_topic_form_extra( (int) wpfval($forum, 'forumid'), (array) wpfval($f, 'meta', 'values') );
430
  }
431
  break;
432
- case 'reply':
433
  if( $topic = wpfval($f, 'meta', 'topic') ){
434
  wpforo_reply_form_extra( $topic, (array) wpfval($f, 'meta', 'values') );
435
  }
429
  wpforo_topic_form_extra( (int) wpfval($forum, 'forumid'), (array) wpfval($f, 'meta', 'values') );
430
  }
431
  break;
432
+ case 'post':
433
  if( $topic = wpfval($f, 'meta', 'topic') ){
434
  wpforo_reply_form_extra( $topic, (array) wpfval($f, 'meta', 'values') );
435
  }
wpf-includes/class-forums.php CHANGED
@@ -289,9 +289,8 @@ class wpForoForum{
289
  array('%d')
290
  )
291
  ){
292
- $childs = array();
293
- $this->get_childs($args['forumid'], $childs);
294
- $sql = "UPDATE `".WPF()->tables->forums."` SET `cat_layout` = ". $args['cat_layout'] ." WHERE `forumid` IN(". implode(',', array_map('intval', $childs)).")";
295
  WPF()->db->query($sql);
296
 
297
  do_action('wpforo_after_edit_forum', $args, $forum, $checkperm);
@@ -315,8 +314,8 @@ class wpForoForum{
315
  return false;
316
  }
317
 
318
- $forumids = array();
319
- $this->get_childs($forumid, $forumids);
320
  foreach( $forumids as $forumid ) $this->__delete($forumid);
321
 
322
  $this->delete_tree_cache();
@@ -472,8 +471,10 @@ class wpForoForum{
472
  if( !is_array($args) ){
473
  if( is_numeric($args) ){
474
  $default['forumid'] = intval($args);
 
475
  }elseif ( is_string($args) ){
476
- $default['slug'] = $args;
 
477
  }
478
  }
479
  $args = wpforo_parse_args( $args, $default );
@@ -665,13 +666,30 @@ class wpForoForum{
665
  }
666
 
667
  /**
668
- * @param int|array $forumids
669
- * @param array $data
670
- * @param bool $merge_forumids_with_data
671
  */
672
- public function get_childs( $forumids, &$data, $merge_forumids_with_data = true ){
673
- if( $forumids = array_map('intval', (array) $forumids) ){
674
- $sql = "SELECT @forumids := GROUP_CONCAT(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  @id := (
676
  SELECT GROUP_CONCAT(`forumid` ORDER BY `order` ASC)
677
  FROM `".WPF()->tables->forums."`
@@ -681,22 +699,37 @@ class wpForoForum{
681
  FROM ( SELECT @id := %s ) vars
682
  STRAIGHT_JOIN `".WPF()->tables->forums."`
683
  WHERE @id IS NOT NULL";
684
- $sql = WPF()->db->prepare($sql, implode(',', $forumids));
685
-
686
- if( WPF()->ram_cache->is_exist($sql) ){
687
- $grouped_forumids = WPF()->ram_cache->get($sql);
688
- }else{
689
- $grouped_forumids = WPF()->db->get_var($sql);
690
- WPF()->ram_cache->set($sql, $grouped_forumids);
691
- }
692
 
693
- if($grouped_forumids){
694
- $data = explode(',', $grouped_forumids);
695
- }
696
- if($merge_forumids_with_data) $data = array_merge($forumids, $data);
697
  }
 
698
  }
699
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
700
  // get forums tree for drop down menu
701
 
702
  /**
@@ -709,6 +742,11 @@ class wpForoForum{
709
  * @param int before calling the function $depth = 0
710
  */
711
  function count_depth($forumid, &$depth){
 
 
 
 
 
712
  $sql = "SELECT `parentid` FROM `".WPF()->tables->forums."` WHERE `forumid` = %d AND `parentid` <> %d";
713
  $sql = WPF()->db->prepare($sql, intval($forumid), intval($forumid));
714
 
@@ -725,18 +763,31 @@ class wpForoForum{
725
  }
726
  }
727
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  /**
729
- * @param int $parent
730
  *
731
  * @return array
732
  */
733
- function get_child_forums($parent){
734
  $sql = "SELECT `forumid`
735
  FROM `".WPF()->tables->forums."`
736
- WHERE `parentid` = ".intval($parent)."
737
- AND `forumid` <> ".intval($parent)."
738
  ORDER BY `order`";
739
- return (array) WPF()->db->get_col($sql);
740
  }
741
 
742
  function forum_list( $forumids, $type = 'select_box', $selected = array(), $cats = TRUE, $disabled = array() ){
@@ -959,26 +1010,18 @@ class wpForoForum{
959
  *
960
  * @param array defined arguments array for returning
961
  *
962
- * @return int count topics
963
  */
964
  function get_counts($forumids){
965
-
966
- if( !empty($forumids) ){
967
-
968
- $wheres = '';
969
-
970
- if(!is_array($forumids)){
971
- $wheres = "`forumid` = " . intval($forumids);
972
- }else{
973
- $wheres = "`forumid` IN(" . implode(', ', array_map('intval', $forumids)) . ")";
974
- }
975
-
976
- $sql = "SELECT SUM(`topics`) as topics, SUM(`posts`) as posts FROM `".WPF()->tables->forums."` WHERE " . $wheres;
977
- return WPF()->db->get_row($sql, ARRAY_A);
978
-
979
  }
980
-
981
- return 0;
982
  }
983
 
984
  /**
@@ -1045,9 +1088,20 @@ class wpForoForum{
1045
  }
1046
  }
1047
 
1048
- function get_parents( $forumid, &$relative_ids){
 
 
 
 
 
1049
  $sql = "SELECT `parentid`, `forumid` FROM `".WPF()->tables->forums."` WHERE `forumid` = %d";
1050
- $forum = WPF()->db->get_row(WPF()->db->prepare($sql, $forumid), ARRAY_A);
 
 
 
 
 
 
1051
  if($forum){
1052
  if($forum['parentid']){
1053
  $relative_ids[] = $forum['forumid'];
@@ -1059,6 +1113,31 @@ class wpForoForum{
1059
  }
1060
  }
1061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1062
  function get_count( $args = array() ){
1063
  $sql = "SELECT SQL_NO_CACHE COUNT(*) FROM `".WPF()->tables->forums."`";
1064
  if( !empty($args) ){
289
  array('%d')
290
  )
291
  ){
292
+ $childs = $this->get_childs($args['forumid']);
293
+ $sql = "UPDATE `".WPF()->tables->forums."` SET `cat_layout` = ". $args['cat_layout'] ." WHERE `forumid` IN(". implode(',', $childs).")";
 
294
  WPF()->db->query($sql);
295
 
296
  do_action('wpforo_after_edit_forum', $args, $forum, $checkperm);
314
  return false;
315
  }
316
 
317
+ $forumids = $this->get_childs($forumid);
318
+ $forumids[] = $forumid;
319
  foreach( $forumids as $forumid ) $this->__delete($forumid);
320
 
321
  $this->delete_tree_cache();
471
  if( !is_array($args) ){
472
  if( is_numeric($args) ){
473
  $default['forumid'] = intval($args);
474
+ if( $default['forumid'] === WPF()->current_object['forumid'] ) return WPF()->current_object['forum'];
475
  }elseif ( is_string($args) ){
476
+ $default['slug'] = trim( $args );
477
+ if( $default['slug'] && $default['slug'] === wpfval( WPF()->current_object['forum'], 'slug' ) ) return WPF()->current_object['forum'];
478
  }
479
  }
480
  $args = wpforo_parse_args( $args, $default );
666
  }
667
 
668
  /**
669
+ * @param int $forumid
670
+ * @return array array of child forumids
 
671
  */
672
+ public function get_childs( $forumid ) {
673
+ $key = array( 'forums', 'get_childs', $forumid );
674
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
675
+
676
+ if ( version_compare( WPF()->db->db_version(), '8.0.0', '>=' ) ) {
677
+ $forumids = $this->__get_childs_mysql8( $forumid );
678
+ } else {
679
+ $forumids = $this->__get_childs( $forumid );
680
+ }
681
+
682
+ WPF()->ram_cache->set($key, $forumids);
683
+ return $forumids;
684
+ }
685
+
686
+ /**
687
+ * @param int $forumid
688
+ * @return array array of child forumids
689
+ */
690
+ private function __get_childs( $forumid ){
691
+ if( $forumid = intval($forumid) ){
692
+ $sql = "SELECT GROUP_CONCAT(
693
  @id := (
694
  SELECT GROUP_CONCAT(`forumid` ORDER BY `order` ASC)
695
  FROM `".WPF()->tables->forums."`
699
  FROM ( SELECT @id := %s ) vars
700
  STRAIGHT_JOIN `".WPF()->tables->forums."`
701
  WHERE @id IS NOT NULL";
702
+ $sql = WPF()->db->prepare($sql, $forumid);
 
 
 
 
 
 
 
703
 
704
+ $forumids = explode(',', (string) WPF()->db->get_var($sql));
705
+ return array_values( array_unique( array_filter( array_map( 'intval', $forumids ) ) ) );
 
 
706
  }
707
+ return array();
708
  }
709
 
710
+ /**
711
+ * @param int $forumid
712
+ * @return array array of child forumids
713
+ */
714
+ private function __get_childs_mysql8( $forumid ){
715
+ if( $forumid = intval($forumid) ){
716
+ $sql = "WITH RECURSIVE `forum_path` AS (
717
+ SELECT `forumid`
718
+ FROM `". WPF()->tables->forums ."`
719
+ WHERE `parentid` = %d
720
+ UNION
721
+ SELECT f.`forumid`
722
+ FROM `". WPF()->tables->forums ."` AS f
723
+ INNER JOIN `forum_path` AS fp ON fp.`forumid` = f.`parentid`
724
+ ) SELECT * FROM `forum_path`";
725
+ $sql = WPF()->db->prepare($sql, $forumid);
726
+
727
+ $forumids = (array) WPF()->db->get_col($sql);
728
+ return array_values( array_unique( array_filter( array_map( 'intval', $forumids ) ) ) );
729
+ }
730
+ return array();
731
+ }
732
+
733
  // get forums tree for drop down menu
734
 
735
  /**
742
  * @param int before calling the function $depth = 0
743
  */
744
  function count_depth($forumid, &$depth){
745
+ if( version_compare( WPF()->db->db_version(), '8.0.0', '>=' ) ){
746
+ $depth = $this->__count_depth_mysql8($forumid);
747
+ return;
748
+ }
749
+
750
  $sql = "SELECT `parentid` FROM `".WPF()->tables->forums."` WHERE `forumid` = %d AND `parentid` <> %d";
751
  $sql = WPF()->db->prepare($sql, intval($forumid), intval($forumid));
752
 
763
  }
764
  }
765
 
766
+ private function __count_depth_mysql8( $forumid ){
767
+ $sql = "WITH RECURSIVE `forum_path` AS(
768
+ SELECT `parentid`, 0 AS `depth`
769
+ FROM `" . WPF()->tables->forums . "`
770
+ WHERE `forumid` = %d
771
+ UNION
772
+ SELECT f.`parentid`, `depth` + 1
773
+ FROM `" . WPF()->tables->forums . "` f
774
+ INNER JOIN `forum_path` fp ON fp.`parentid` = f.`forumid`
775
+ ) SELECT `depth` FROM `forum_path` ORDER BY `depth` DESC LIMIT 1";
776
+ return (int) WPF()->db->get_var( WPF()->db->prepare( $sql, intval( $forumid ) ) );
777
+ }
778
+
779
  /**
780
+ * @param int $forumid
781
  *
782
  * @return array
783
  */
784
+ function get_child_forums($forumid){
785
  $sql = "SELECT `forumid`
786
  FROM `".WPF()->tables->forums."`
787
+ WHERE `parentid` = ".intval($forumid) . "
788
+ AND `forumid` <> ".intval($forumid) . "
789
  ORDER BY `order`";
790
+ return array_map( 'intval', (array) WPF()->db->get_col($sql) );
791
  }
792
 
793
  function forum_list( $forumids, $type = 'select_box', $selected = array(), $cats = TRUE, $disabled = array() ){
1010
  *
1011
  * @param array defined arguments array for returning
1012
  *
1013
+ * @return array array('topics' => 0, 'posts' => 0)
1014
  */
1015
  function get_counts($forumids){
1016
+ $result = array('topics' => 0, 'posts' => 0);
1017
+ $forumids = array_filter( array_map( 'intval', (array) $forumids ) );
1018
+ if( $forumids ){
1019
+ $sql = "SELECT SUM(`topics`) as topics, SUM(`posts`) as posts FROM `".WPF()->tables->forums."` WHERE `forumid` IN(" . implode(',', $forumids) . ")";
1020
+ $row = (array) WPF()->db->get_row($sql, ARRAY_A);
1021
+ $result['topics'] = (int) wpfval( $row, 'topics' );
1022
+ $result['posts'] = (int) wpfval( $row, 'posts' );
 
 
 
 
 
 
 
1023
  }
1024
+ return $result;
 
1025
  }
1026
 
1027
  /**
1088
  }
1089
  }
1090
 
1091
+ function get_parents( $forumid, &$relative_ids ){
1092
+ if( version_compare( WPF()->db->db_version(), '8.0.0', '>=' ) ){
1093
+ $relative_ids = $this->__get_parents_mysql8( $forumid );
1094
+ return;
1095
+ }
1096
+
1097
  $sql = "SELECT `parentid`, `forumid` FROM `".WPF()->tables->forums."` WHERE `forumid` = %d";
1098
+ $sql = WPF()->db->prepare( $sql, $forumid );
1099
+ if( WPF()->ram_cache->is_exist( $sql ) ){
1100
+ $forum = WPF()->ram_cache->get( $sql );
1101
+ }else{
1102
+ $forum = WPF()->db->get_row( $sql, ARRAY_A );
1103
+ WPF()->ram_cache->set( $sql, $forum );
1104
+ }
1105
  if($forum){
1106
  if($forum['parentid']){
1107
  $relative_ids[] = $forum['forumid'];
1113
  }
1114
  }
1115
 
1116
+ /**
1117
+ * @param int $forumid
1118
+ *
1119
+ * @return array
1120
+ */
1121
+ private function __get_parents_mysql8( $forumid ) {
1122
+ $sql = "WITH RECURSIVE `forum_path` AS(
1123
+ SELECT `forumid`, `parentid`, 0 AS `depth`
1124
+ FROM `".WPF()->tables->forums."`
1125
+ WHERE `forumid` = %d
1126
+ UNION
1127
+ SELECT f.`forumid`, f.`parentid`, `depth` + 1
1128
+ FROM `".WPF()->tables->forums."` f
1129
+ INNER JOIN `forum_path` fp ON fp.`parentid` = f.`forumid`
1130
+ ) SELECT `forumid` FROM `forum_path` ORDER BY `depth` DESC";
1131
+ $sql = WPF()->db->prepare( $sql, intval($forumid) );
1132
+ if( WPF()->ram_cache->is_exist( $sql ) ){
1133
+ $relative_ids = WPF()->ram_cache->get( $sql );
1134
+ }else{
1135
+ $relative_ids = (array) WPF()->db->get_col($sql);
1136
+ WPF()->ram_cache->set( $sql, $relative_ids );
1137
+ }
1138
+ return $relative_ids;
1139
+ }
1140
+
1141
  function get_count( $args = array() ){
1142
  $sql = "SELECT SQL_NO_CACHE COUNT(*) FROM `".WPF()->tables->forums."`";
1143
  if( !empty($args) ){
wpf-includes/class-members.php CHANGED
@@ -1377,6 +1377,7 @@ class wpForoMember{
1377
  array('%d')
1378
  )
1379
  ){
 
1380
  $this->reset($userid);
1381
  WPF()->notice->add('User successfully banned from wpforo', 'success');
1382
  return TRUE;
@@ -1399,6 +1400,7 @@ class wpForoMember{
1399
  array('%d')
1400
  )
1401
  ){
 
1402
  $this->reset($userid);
1403
  WPF()->notice->add('User successfully unbanned from wpforo', 'success');
1404
  return TRUE;
@@ -1572,51 +1574,133 @@ class wpForoMember{
1572
  return $img;
1573
  }
1574
 
 
 
 
 
 
1575
  public function get_topics_count( $userid ){
1576
- $count = WPF()->db->get_var("SELECT count(topicid) FROM `".WPF()->tables->topics."` WHERE `userid` = ".intval($userid));
1577
- return $count;
 
 
 
 
 
1578
  }
1579
 
 
 
 
 
 
1580
  public function get_questions_count( $userid ){
1581
- $count = WPF()->db->get_var("SELECT count(topicid) FROM `".WPF()->tables->topics."` WHERE `userid` = ".intval($userid));
1582
- return $count;
 
 
 
 
 
1583
  }
1584
 
 
 
 
 
 
1585
  public function get_answers_count( $userid ){
1586
- $count = WPF()->db->get_var("SELECT count(postid) FROM `".WPF()->tables->posts."` WHERE `is_answer` = 1 AND `userid` = ".intval($userid));
1587
- return $count;
 
 
 
 
 
1588
  }
1589
 
 
 
 
 
 
1590
  public function get_question_comments_count( $userid ){
1591
- $count = WPF()->db->get_var("SELECT count(postid) FROM `".WPF()->tables->posts."` WHERE `parentid` > 0 AND `userid` = ".intval($userid));
1592
- return $count;
 
 
 
 
 
1593
  }
1594
 
 
 
 
 
 
1595
  public function get_replies_count( $userid ){
1596
- $count = WPF()->db->get_var("SELECT count(postid) FROM `".WPF()->tables->posts."` WHERE `userid` = ".intval($userid));
1597
- return $count;
 
 
 
 
 
1598
  }
1599
 
 
 
 
 
 
1600
  public function get_likes_count( $userid ){
1601
- $count = WPF()->db->get_var("SELECT count(likeid) FROM `".WPF()->tables->likes."` WHERE `userid` = ".intval($userid));
1602
- return $count;
 
 
 
 
 
1603
  }
1604
 
 
 
 
 
 
1605
  public function get_votes_count( $userid ){
1606
- $count = WPF()->db->get_var("SELECT count(voteid) FROM `".WPF()->tables->votes."` WHERE `userid` = ".intval($userid));
1607
- return $count;
 
 
 
 
 
1608
  }
1609
 
1610
  // how many times the user like or vote
1611
  public function get_votes_and_likes_count( $userid ){
1612
- return $this->get_votes_count( intval($userid) ) + $this->get_likes_count( intval($userid) );
1613
  }
1614
 
1615
- //getting user's posts votes and likes count
 
 
 
 
 
1616
  public function get_user_votes_and_likes_count( $userid ){
1617
- $votes_count = WPF()->db->get_var("SELECT count(voteid) FROM `".WPF()->tables->votes."` WHERE `post_userid` = ".intval($userid));
1618
- $likes_count = WPF()->db->get_var("SELECT count(likeid) FROM `".WPF()->tables->likes."` WHERE `post_userid` = ".intval($userid));
1619
- return $votes_count + $likes_count;
 
 
 
 
 
 
 
1620
  }
1621
 
1622
  public function get_profile_url( $arg, $template = 'profile' ){
@@ -1786,12 +1870,18 @@ class wpForoMember{
1786
  }
1787
 
1788
  public function online_members_count( $duration = NULL ){
1789
- if(!$duration) $duration = $this->options['online_status_timeout'];
1790
- $current_time = current_time( 'timestamp', 1 );
1791
- $online_timeframe = $current_time - $duration;
1792
- $online = WPF()->db->get_var( "SELECT COUNT(DISTINCT `userid`, `ip`) AS total FROM `".WPF()->tables->visits."` WHERE `time` > " . intval($online_timeframe) );
1793
- if( !$online ) $online = WPF()->db->get_var( "SELECT COUNT(*) FROM `".WPF()->tables->profiles."` WHERE `online_time` > " . intval($online_timeframe) );
1794
- return $online;
 
 
 
 
 
 
1795
  }
1796
 
1797
  public function get_online_members( $count = 1, $groupids = array(), $duration = NULL ){
@@ -1810,8 +1900,7 @@ class wpForoMember{
1810
  }
1811
 
1812
  public function levels(){
1813
- $levels = array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1814
- return $levels;
1815
  }
1816
 
1817
  public function rating( $level = false, $var = false, $default = false ){
@@ -2050,10 +2139,16 @@ class wpForoMember{
2050
  }
2051
  }
2052
  }
2053
-
 
 
 
2054
  public function banned_count(){
2055
- $count = WPF()->db->get_var("SELECT count(*) FROM `".WPF()->tables->profiles."` WHERE `status` = 'banned' " );
2056
- return intval($count);
 
 
 
2057
  }
2058
 
2059
  public function get_guest( $args = array() ){
@@ -2435,18 +2530,18 @@ class wpForoMember{
2435
  'isSearchable' => 1
2436
  );
2437
 
2438
- $this->fields['gtalk'] = array(
2439
- 'fieldKey' => 'gtalk',
2440
  'type' => 'url',
2441
- 'isDefault' => 1,
2442
- 'isRemovable' => 0,
2443
  'isRequired' => 0,
2444
  'isEditable' => 1,
2445
- 'label' => wpforo_phrase( 'Google+', false ),
2446
- 'title' => wpforo_phrase( 'Google+', false ),
2447
- 'placeholder' => wpforo_phrase( 'Google+', false ),
2448
- 'faIcon' => 'fab fa-google-plus-square',
2449
- 'name' => 'gtalk',
2450
  'cantBeInactive' => array(),
2451
  'canEdit' => $usergroupids_can_edit_fields,
2452
  'canView' => $usergroupids_can_view_social_net,
@@ -2454,18 +2549,18 @@ class wpForoMember{
2454
  'isSearchable' => 1
2455
  );
2456
 
2457
- $this->fields['yahoo'] = array(
2458
- 'fieldKey' => 'yahoo',
2459
- 'type' => 'text',
2460
- 'isDefault' => 1,
2461
- 'isRemovable' => 0,
2462
  'isRequired' => 0,
2463
  'isEditable' => 1,
2464
- 'label' => wpforo_phrase( 'Yahoo', false ),
2465
- 'title' => wpforo_phrase( 'Yahoo', false ),
2466
- 'placeholder' => wpforo_phrase( 'Yahoo', false ),
2467
- 'faIcon' => 'fab fa-yahoo',
2468
- 'name' => 'yahoo',
2469
  'cantBeInactive' => array(),
2470
  'canEdit' => $usergroupids_can_edit_fields,
2471
  'canView' => $usergroupids_can_view_social_net,
@@ -2473,18 +2568,18 @@ class wpForoMember{
2473
  'isSearchable' => 1
2474
  );
2475
 
2476
- $this->fields['aim'] = array(
2477
- 'fieldKey' => 'aim',
2478
- 'type' => 'text',
2479
- 'isDefault' => 1,
2480
- 'isRemovable' => 0,
2481
  'isRequired' => 0,
2482
  'isEditable' => 1,
2483
- 'label' => wpforo_phrase( 'AOL IM', false ),
2484
- 'title' => wpforo_phrase( 'AOL IM', false ),
2485
- 'placeholder' => wpforo_phrase( 'AOL IM', false ),
2486
- 'faIcon' => 'fas fa-share-alt',
2487
- 'name' => 'aim',
2488
  'cantBeInactive' => array(),
2489
  'canEdit' => $usergroupids_can_edit_fields,
2490
  'canView' => $usergroupids_can_view_social_net,
@@ -2492,18 +2587,18 @@ class wpForoMember{
2492
  'isSearchable' => 1
2493
  );
2494
 
2495
- $this->fields['icq'] = array(
2496
- 'fieldKey' => 'icq',
2497
  'type' => 'text',
2498
- 'isDefault' => 1,
2499
- 'isRemovable' => 0,
2500
  'isRequired' => 0,
2501
  'isEditable' => 1,
2502
- 'label' => wpforo_phrase( 'ICQ', false ),
2503
- 'title' => wpforo_phrase( 'ICQ', false ),
2504
- 'placeholder' => wpforo_phrase( 'ICQ', false ),
2505
- 'faIcon' => 'fas fa-share-alt',
2506
- 'name' => 'icq',
2507
  'cantBeInactive' => array(),
2508
  'canEdit' => $usergroupids_can_edit_fields,
2509
  'canView' => $usergroupids_can_view_social_net,
@@ -2511,18 +2606,18 @@ class wpForoMember{
2511
  'isSearchable' => 1
2512
  );
2513
 
2514
- $this->fields['msn'] = array(
2515
- 'fieldKey' => 'msn',
2516
- 'type' => 'text',
2517
- 'isDefault' => 1,
2518
- 'isRemovable' => 0,
2519
  'isRequired' => 0,
2520
  'isEditable' => 1,
2521
- 'label' => wpforo_phrase( 'MSN', false ),
2522
- 'title' => wpforo_phrase( 'MSN', false ),
2523
- 'placeholder' => wpforo_phrase( 'MSN', false ),
2524
- 'faIcon' => 'fas fa-share-alt',
2525
- 'name' => 'msn',
2526
  'cantBeInactive' => array(),
2527
  'canEdit' => $usergroupids_can_edit_fields,
2528
  'canView' => $usergroupids_can_view_social_net,
@@ -2851,14 +2946,14 @@ class wpForoMember{
2851
  ),
2852
  array(
2853
  'facebook',
2854
- 'gtalk',
2855
- 'aim',
2856
- 'msn'
2857
  ),
2858
  array(
2859
  'twitter',
2860
- 'yahoo',
2861
- 'icq',
2862
  'skype'
2863
  )
2864
  ),
@@ -2902,14 +2997,14 @@ class wpForoMember{
2902
  array(
2903
  array(
2904
  'facebook',
2905
- 'gtalk',
2906
- 'aim',
2907
- 'msn',
2908
  ),
2909
  array(
2910
  'twitter',
2911
- 'yahoo',
2912
- 'icq',
2913
  'skype'
2914
  )
2915
  ),
1377
  array('%d')
1378
  )
1379
  ){
1380
+ do_action('wpforo_after_ban_user', $userid);
1381
  $this->reset($userid);
1382
  WPF()->notice->add('User successfully banned from wpforo', 'success');
1383
  return TRUE;
1400
  array('%d')
1401
  )
1402
  ){
1403
+ do_action('wpforo_after_unban_user', $userid);
1404
  $this->reset($userid);
1405
  WPF()->notice->add('User successfully unbanned from wpforo', 'success');
1406
  return TRUE;
1574
  return $img;
1575
  }
1576
 
1577
+ /**
1578
+ * @param int $userid
1579
+ *
1580
+ * @return int
1581
+ */
1582
  public function get_topics_count( $userid ){
1583
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1584
+ $key = array('member', 'get_topics_count', $userid);
1585
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1586
+ $sql = "SELECT count(topicid) FROM `".WPF()->tables->topics."` WHERE `userid` = %d";
1587
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1588
+ WPF()->ram_cache->set($key, $var);
1589
+ return $var;
1590
  }
1591
 
1592
+ /**
1593
+ * @param int $userid
1594
+ *
1595
+ * @return int
1596
+ */
1597
  public function get_questions_count( $userid ){
1598
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1599
+ $key = array('member', 'get_questions_count', $userid);
1600
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1601
+ $sql = "SELECT count(topicid) FROM `".WPF()->tables->topics."` WHERE `userid` = %d";
1602
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1603
+ WPF()->ram_cache->set($key, $var);
1604
+ return $var;
1605
  }
1606
 
1607
+ /**
1608
+ * @param int $userid
1609
+ *
1610
+ * @return int
1611
+ */
1612
  public function get_answers_count( $userid ){
1613
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1614
+ $key = array('member', 'get_answers_count', $userid);
1615
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1616
+ $sql = "SELECT count(postid) FROM `".WPF()->tables->posts."` WHERE `is_answer` = 1 AND `userid` = %d";
1617
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1618
+ WPF()->ram_cache->set($key, $var);
1619
+ return $var;
1620
  }
1621
 
1622
+ /**
1623
+ * @param int $userid
1624
+ *
1625
+ * @return int
1626
+ */
1627
  public function get_question_comments_count( $userid ){
1628
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1629
+ $key = array('member', 'get_question_comments_count', $userid);
1630
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1631
+ $sql = "SELECT count(postid) FROM `".WPF()->tables->posts."` WHERE `parentid` > 0 AND `userid` = %d";
1632
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1633
+ WPF()->ram_cache->set($key, $var);
1634
+ return $var;
1635
  }
1636
 
1637
+ /**
1638
+ * @param int $userid
1639
+ *
1640
+ * @return int
1641
+ */
1642
  public function get_replies_count( $userid ){
1643
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1644
+ $key = array('member', 'get_replies_count', $userid);
1645
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1646
+ $sql = "SELECT count(postid) FROM `".WPF()->tables->posts."` WHERE `userid` = %d";
1647
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1648
+ WPF()->ram_cache->set($key, $var);
1649
+ return $var;
1650
  }
1651
 
1652
+ /**
1653
+ * @param int $userid
1654
+ *
1655
+ * @return int
1656
+ */
1657
  public function get_likes_count( $userid ){
1658
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1659
+ $key = array('member', 'get_likes_count', $userid);
1660
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1661
+ $sql = "SELECT count(likeid) FROM `".WPF()->tables->likes."` WHERE `userid` = %d";
1662
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1663
+ WPF()->ram_cache->set($key, $var);
1664
+ return $var;
1665
  }
1666
 
1667
+ /**
1668
+ * @param int $userid
1669
+ *
1670
+ * @return int
1671
+ */
1672
  public function get_votes_count( $userid ){
1673
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1674
+ $key = array('member', 'get_votes_count', $userid);
1675
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1676
+ $sql = "SELECT count(voteid) FROM `".WPF()->tables->votes."` WHERE `userid` = %d";
1677
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1678
+ WPF()->ram_cache->set($key, $var);
1679
+ return $var;
1680
  }
1681
 
1682
  // how many times the user like or vote
1683
  public function get_votes_and_likes_count( $userid ){
1684
+ return $this->get_votes_count( $userid ) + $this->get_likes_count( $userid );
1685
  }
1686
 
1687
+ /**
1688
+ * getting user's posts votes and likes count
1689
+ * @param int $userid
1690
+ *
1691
+ * @return int
1692
+ */
1693
  public function get_user_votes_and_likes_count( $userid ){
1694
+ if( !($userid = wpforo_bigintval($userid)) ) return 0;
1695
+ $key = array('member', 'get_user_votes_and_likes_count', $userid);
1696
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1697
+ $sql = "SELECT COUNT(voteid) FROM `".WPF()->tables->votes."` WHERE `post_userid` = %d";
1698
+ $votes_count = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1699
+ $sql = "SELECT COUNT(likeid) FROM `".WPF()->tables->likes."` WHERE `post_userid` = %d";
1700
+ $likes_count = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $userid) );
1701
+ $var = $votes_count + $likes_count;
1702
+ WPF()->ram_cache->set($key, $var);
1703
+ return $var;
1704
  }
1705
 
1706
  public function get_profile_url( $arg, $template = 'profile' ){
1870
  }
1871
 
1872
  public function online_members_count( $duration = NULL ){
1873
+ if( !($duration = intval($duration)) ) $duration = (int) $this->options['online_status_timeout'];
1874
+ $online_timeframe = current_time( 'timestamp', 1 ) - $duration;
1875
+ $key = array('member', 'online_members_count', $online_timeframe);
1876
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
1877
+ $sql = "SELECT COUNT(DISTINCT `userid`, `ip`) AS total FROM `".WPF()->tables->visits."` WHERE `time` > %d";
1878
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $online_timeframe) );
1879
+ if( !$var ) {
1880
+ $sql = "SELECT COUNT(*) FROM `" . WPF()->tables->profiles . "` WHERE `online_time` > %d";
1881
+ $var = (int) WPF()->db->get_var( WPF()->db->prepare($sql, $online_timeframe) );
1882
+ }
1883
+ WPF()->ram_cache->set($key, $var);
1884
+ return $var;
1885
  }
1886
 
1887
  public function get_online_members( $count = 1, $groupids = array(), $duration = NULL ){
1900
  }
1901
 
1902
  public function levels(){
1903
+ return array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
 
1904
  }
1905
 
1906
  public function rating( $level = false, $var = false, $default = false ){
2139
  }
2140
  }
2141
  }
2142
+
2143
+ /**
2144
+ * @return int
2145
+ */
2146
  public function banned_count(){
2147
+ $key = array('member', 'banned_count');
2148
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
2149
+ $var = (int) WPF()->db->get_var("SELECT count(*) FROM `".WPF()->tables->profiles."` WHERE `status` = 'banned'" );
2150
+ WPF()->ram_cache->set($key, $var);
2151
+ return $var;
2152
  }
2153
 
2154
  public function get_guest( $args = array() ){
2530
  'isSearchable' => 1
2531
  );
2532
 
2533
+ $this->fields['youtube'] = array(
2534
+ 'fieldKey' => 'youtube',
2535
  'type' => 'url',
2536
+ 'isDefault' => 0,
2537
+ 'isRemovable' => 1,
2538
  'isRequired' => 0,
2539
  'isEditable' => 1,
2540
+ 'label' => wpforo_phrase( 'YouTube', false ),
2541
+ 'title' => wpforo_phrase( 'YouTube', false ),
2542
+ 'placeholder' => wpforo_phrase( 'YouTube', false ),
2543
+ 'faIcon' => 'fab fa-youtube',
2544
+ 'name' => 'youtube',
2545
  'cantBeInactive' => array(),
2546
  'canEdit' => $usergroupids_can_edit_fields,
2547
  'canView' => $usergroupids_can_view_social_net,
2549
  'isSearchable' => 1
2550
  );
2551
 
2552
+ $this->fields['vkontakte'] = array(
2553
+ 'fieldKey' => 'vkontakte',
2554
+ 'type' => 'url',
2555
+ 'isDefault' => 0,
2556
+ 'isRemovable' => 1,
2557
  'isRequired' => 0,
2558
  'isEditable' => 1,
2559
+ 'label' => wpforo_phrase( 'VKontakte', false ),
2560
+ 'title' => wpforo_phrase( 'VKontakte', false ),
2561
+ 'placeholder' => wpforo_phrase( 'VKontakte', false ),
2562
+ 'faIcon' => 'fab fa-vk',
2563
+ 'name' => 'vkontakte',
2564
  'cantBeInactive' => array(),
2565
  'canEdit' => $usergroupids_can_edit_fields,
2566
  'canView' => $usergroupids_can_view_social_net,
2568
  'isSearchable' => 1
2569
  );
2570
 
2571
+ $this->fields['linkedin'] = array(
2572
+ 'fieldKey' => 'linkedin',
2573
+ 'type' => 'url',
2574
+ 'isDefault' => 0,
2575
+ 'isRemovable' => 1,
2576
  'isRequired' => 0,
2577
  'isEditable' => 1,
2578
+ 'label' => wpforo_phrase( 'LinkedIn', false ),
2579
+ 'title' => wpforo_phrase( 'LinkedIn', false ),
2580
+ 'placeholder' => wpforo_phrase( 'LinkedIn', false ),
2581
+ 'faIcon' => 'fab fa-linkedin-in',
2582
+ 'name' => 'linkedin',
2583
  'cantBeInactive' => array(),
2584
  'canEdit' => $usergroupids_can_edit_fields,
2585
  'canView' => $usergroupids_can_view_social_net,
2587
  'isSearchable' => 1
2588
  );
2589
 
2590
+ $this->fields['telegram'] = array(
2591
+ 'fieldKey' => 'telegram',
2592
  'type' => 'text',
2593
+ 'isDefault' => 0,
2594
+ 'isRemovable' => 1,
2595
  'isRequired' => 0,
2596
  'isEditable' => 1,
2597
+ 'label' => wpforo_phrase( 'Telegram', false ),
2598
+ 'title' => wpforo_phrase( 'Telegram', false ),
2599
+ 'placeholder' => wpforo_phrase( 'Telegram', false ),
2600
+ 'faIcon' => 'fab fa-telegram-plane',
2601
+ 'name' => 'telegram',
2602
  'cantBeInactive' => array(),
2603
  'canEdit' => $usergroupids_can_edit_fields,
2604
  'canView' => $usergroupids_can_view_social_net,
2606
  'isSearchable' => 1
2607
  );
2608
 
2609
+ $this->fields['instagram'] = array(
2610
+ 'fieldKey' => 'instagram',
2611
+ 'type' => 'url',
2612
+ 'isDefault' => 0,
2613
+ 'isRemovable' => 1,
2614
  'isRequired' => 0,
2615
  'isEditable' => 1,
2616
+ 'label' => wpforo_phrase( 'Instagram', false ),
2617
+ 'title' => wpforo_phrase( 'Instagram', false ),
2618
+ 'placeholder' => wpforo_phrase( 'Instagram', false ),
2619
+ 'faIcon' => 'fab fa-instagram',
2620
+ 'name' => 'instagram',
2621
  'cantBeInactive' => array(),
2622
  'canEdit' => $usergroupids_can_edit_fields,
2623
  'canView' => $usergroupids_can_view_social_net,
2946
  ),
2947
  array(
2948
  'facebook',
2949
+ 'linkedin',
2950
+ 'instagram',
2951
+ 'vkontakte'
2952
  ),
2953
  array(
2954
  'twitter',
2955
+ 'youtube',
2956
+ 'telegram',
2957
  'skype'
2958
  )
2959
  ),
2997
  array(
2998
  array(
2999
  'facebook',
3000
+ 'linkedin',
3001
+ 'instagram',
3002
+ 'vkontakte',
3003
  ),
3004
  array(
3005
  'twitter',
3006
+ 'youtube',
3007
+ 'telegram',
3008
  'skype'
3009
  )
3010
  ),
wpf-includes/class-notices.php CHANGED
@@ -4,8 +4,9 @@
4
 
5
 
6
  class wpForoNotices{
7
- private $types = array();
8
- private $notices = array();
 
9
 
10
  private function init_types() {
11
  $this->types = array_merge(
@@ -15,6 +16,28 @@ class wpForoNotices{
15
  $this->types = array_map('strtolower', array_unique($this->types));
16
  }
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  private function reset() {
19
  foreach ( $this->types as $type ) $this->notices[$type] = array();
20
  }
@@ -31,6 +54,7 @@ class wpForoNotices{
31
  }
32
 
33
  public function init() {
 
34
  if( WPF()->session_token ){
35
  $sql = "SELECT DISTINCT `key`, `value` FROM `" . WPF()->tables->logs . "` WHERE `sessionid` = %s AND `key` IN('". implode("','", $this->types) ."')";
36
  if( $notices = (array) WPF()->db->get_results( WPF()->db->prepare($sql, WPF()->session_token), ARRAY_A ) ){
@@ -178,14 +202,14 @@ class wpForoNotices{
178
  $notice = (array) $notice;
179
  foreach ($notice as $msg){
180
  if( !is_array($msg) && ($msg = trim($msg)) ){
181
- $inner .= sprintf('<p class="%s">%s</p>', sanitize_html_class($type), $msg);
182
  }
183
  }
184
  }
185
  ?>
186
  <script type="text/javascript">
187
  window.jQuery(document).ready(function(){
188
- wpforo_notice_show("<?php echo addslashes(wpforo_kses($inner)) ?>");
189
  });
190
  </script>
191
  <?php
4
 
5
 
6
  class wpForoNotices{
7
+ private $types = array();
8
+ private $notices = array();
9
+ private $timeouts = array();
10
 
11
  private function init_types() {
12
  $this->types = array_merge(
16
  $this->types = array_map('strtolower', array_unique($this->types));
17
  }
18
 
19
+ private function init_timeouts() {
20
+ foreach ( $this->types as $type ) $this->timeouts[$type] = $this->get_timeout($type);
21
+ }
22
+
23
+ private function get_timeout($type){
24
+ switch ( $type ) {
25
+ case "success":
26
+ $durr = 4000;
27
+ break;
28
+ case "neutral":
29
+ $durr = 0;
30
+ break;
31
+ default:
32
+ $durr = 8000;
33
+ }
34
+ return apply_filters("wpforo_notice_timeout_{$type}", $durr);
35
+ }
36
+
37
+ public function get_timeouts() {
38
+ return $this->timeouts;
39
+ }
40
+
41
  private function reset() {
42
  foreach ( $this->types as $type ) $this->notices[$type] = array();
43
  }
54
  }
55
 
56
  public function init() {
57
+ $this->init_timeouts();
58
  if( WPF()->session_token ){
59
  $sql = "SELECT DISTINCT `key`, `value` FROM `" . WPF()->tables->logs . "` WHERE `sessionid` = %s AND `key` IN('". implode("','", $this->types) ."')";
60
  if( $notices = (array) WPF()->db->get_results( WPF()->db->prepare($sql, WPF()->session_token), ARRAY_A ) ){
202
  $notice = (array) $notice;
203
  foreach ($notice as $msg){
204
  if( !is_array($msg) && ($msg = trim($msg)) ){
205
+ $inner .= sprintf('wpforo_notice_show("%1$s", "%2$s")', addslashes(wpforo_kses($msg)), sanitize_html_class($type));
206
  }
207
  }
208
  }
209
  ?>
210
  <script type="text/javascript">
211
  window.jQuery(document).ready(function(){
212
+ <?php echo $inner ?>
213
  });
214
  </script>
215
  <?php
wpf-includes/class-permissions.php CHANGED
@@ -370,7 +370,7 @@ class wpForoPermissions{
370
  ){
371
  WPF()->notice->clear();
372
  WPF()->notice->add('Permission denied', 'error');
373
- wp_redirect(wpforo_get_request_uri());
374
  exit();
375
  }
376
 
370
  ){
371
  WPF()->notice->clear();
372
  WPF()->notice->add('Permission denied', 'error');
373
+ wp_safe_redirect(wpforo_get_request_uri());
374
  exit();
375
  }
376
 
wpf-includes/class-postmeta.php CHANGED
@@ -13,8 +13,8 @@ class wpForoPostMeta {
13
  private function init_hooks(){
14
  add_action('wpforo_after_add_topic', array($this, 'after_add_topic'), 10, 2);
15
  add_action('wpforo_after_edit_topic', array($this, 'after_edit_topic'), 10, 3);
16
- add_action('wpforo_after_add_post', array($this, 'after_add_post'));
17
- add_action('wpforo_after_edit_post', array($this, 'after_edit_post'), 10, 2);
18
  add_action('wpforo_after_move_topic', array($this, 'after_move_topic'), 10, 2);
19
  add_action('wpforo_after_merge_topic', array($this, 'after_merge_topic'), 10, 3);
20
  add_action('wpforo_after_delete_post', array($this, 'after_delete_post'));
@@ -403,7 +403,7 @@ class wpForoPostMeta {
403
  }
404
  }
405
 
406
- private function add_file( $post ){
407
  $postid = (int) (wpfval($post, 'first_postid') ? $post['first_postid'] : wpfval($post, 'postid'));
408
 
409
  if( $wpftcf_delete = array_filter( (array) wpfval($_POST, 'wpftcf_delete') ) ){
@@ -414,12 +414,12 @@ class wpForoPostMeta {
414
 
415
  if( !empty( wpfval($_FILES, 'data', 'type') ) ){
416
  $forum = WPF()->forum->get_forum($post['forumid']);
417
- $fields_list = WPF()->post->get_topic_fields_list(false, $forum);
418
  $mime_types = wp_get_mime_types();
419
  $allowed_mime_types = get_allowed_mime_types();
420
  foreach( $_FILES['data']['type'] as $k => $mime_type ){
421
  if( in_array($k, $fields_list) ){
422
- $field = WPF()->post->get_field($k, $forum);
423
  $label = ($field['label'] ? $field['label'] : $field['fieldKey']);
424
 
425
  if( $error = intval( wpfval($_FILES, 'data', 'error', $k) ) ){
@@ -512,10 +512,10 @@ class wpForoPostMeta {
512
  }
513
 
514
  public function after_add_topic($topic, $forum){
515
- $this->add_file($topic);
516
 
517
  if( !empty($topic['postmetas']) ){
518
- $fields_list = WPF()->post->get_topic_fields_list(false, $forum);
519
  foreach ( $topic['postmetas'] as $metakey => $metavalue ){
520
  if( in_array( $metakey, $fields_list ) ){
521
  $postmeta = array(
@@ -535,10 +535,10 @@ class wpForoPostMeta {
535
  }
536
 
537
  public function after_edit_topic($topic, $args, $forum){
538
- $this->add_file($topic);
539
 
540
  if( !empty($args['postmetas']) ){
541
- $fields_list = WPF()->post->get_topic_fields_list(false, $forum);
542
  foreach ( $args['postmetas'] as $metakey => $metavalue ){
543
  if( in_array( $metakey, $fields_list ) ){
544
  $postmeta = array(
@@ -564,11 +564,11 @@ class wpForoPostMeta {
564
  }
565
  }
566
 
567
- public function after_add_post($post){
568
- $this->add_file($post);
569
 
570
  if( !empty($post['postmetas']) ){
571
- $fields_list = WPF()->post->get_post_fields_list();
572
  foreach ( $post['postmetas'] as $metakey => $metavalue ){
573
  if( in_array( $metakey, $fields_list ) ){
574
  $postmeta = array(
@@ -587,11 +587,11 @@ class wpForoPostMeta {
587
  }
588
  }
589
 
590
- public function after_edit_post($post, $args){
591
- $this->add_file($post);
592
 
593
  if( !empty($args['postmetas']) ){
594
- $fields_list = WPF()->post->get_post_fields_list();
595
  foreach ( $args['postmetas'] as $metakey => $metavalue ){
596
  if( in_array( $metakey, $fields_list ) ){
597
  $postmeta = array(
13
  private function init_hooks(){
14
  add_action('wpforo_after_add_topic', array($this, 'after_add_topic'), 10, 2);
15
  add_action('wpforo_after_edit_topic', array($this, 'after_edit_topic'), 10, 3);
16
+ add_action('wpforo_after_add_post', array($this, 'after_add_post'), 10, 3);
17
+ add_action('wpforo_after_edit_post', array($this, 'after_edit_post'), 10, 4);
18
  add_action('wpforo_after_move_topic', array($this, 'after_move_topic'), 10, 2);
19
  add_action('wpforo_after_merge_topic', array($this, 'after_merge_topic'), 10, 3);
20
  add_action('wpforo_after_delete_post', array($this, 'after_delete_post'));
403
  }
404
  }
405
 
406
+ private function add_file( $type, $post ){
407
  $postid = (int) (wpfval($post, 'first_postid') ? $post['first_postid'] : wpfval($post, 'postid'));
408
 
409
  if( $wpftcf_delete = array_filter( (array) wpfval($_POST, 'wpftcf_delete') ) ){
414
 
415
  if( !empty( wpfval($_FILES, 'data', 'type') ) ){
416
  $forum = WPF()->forum->get_forum($post['forumid']);
417
+ $fields_list = WPF()->post->get_topic_fields_list(false, $forum, !WPF()->current_userid);
418
  $mime_types = wp_get_mime_types();
419
  $allowed_mime_types = get_allowed_mime_types();
420
  foreach( $_FILES['data']['type'] as $k => $mime_type ){
421
  if( in_array($k, $fields_list) ){
422
+ $field = WPF()->post->get_field($k, $type, $forum);
423
  $label = ($field['label'] ? $field['label'] : $field['fieldKey']);
424
 
425
  if( $error = intval( wpfval($_FILES, 'data', 'error', $k) ) ){
512
  }
513
 
514
  public function after_add_topic($topic, $forum){
515
+ $this->add_file('topic', $topic );
516
 
517
  if( !empty($topic['postmetas']) ){
518
+ $fields_list = WPF()->post->get_topic_fields_list(false, $forum, !WPF()->current_userid);
519
  foreach ( $topic['postmetas'] as $metakey => $metavalue ){
520
  if( in_array( $metakey, $fields_list ) ){
521
  $postmeta = array(
535
  }
536
 
537
  public function after_edit_topic($topic, $args, $forum){
538
+ $this->add_file('topic', $topic);
539
 
540
  if( !empty($args['postmetas']) ){
541
+ $fields_list = WPF()->post->get_topic_fields_list(false, $forum, !WPF()->current_userid);
542
  foreach ( $args['postmetas'] as $metakey => $metavalue ){
543
  if( in_array( $metakey, $fields_list ) ){
544
  $postmeta = array(
564
  }
565
  }
566
 
567
+ public function after_add_post($post, $topic, $forum){
568
+ $this->add_file('post', $post);
569
 
570
  if( !empty($post['postmetas']) ){
571
+ $fields_list = WPF()->post->get_post_fields_list(false, $forum, !WPF()->current_userid);
572
  foreach ( $post['postmetas'] as $metakey => $metavalue ){
573
  if( in_array( $metakey, $fields_list ) ){
574
  $postmeta = array(
587
  }
588
  }
589
 
590
+ public function after_edit_post($post, $topic, $forum, $args ){
591
+ $this->add_file('post', $post);
592
 
593
  if( !empty($args['postmetas']) ){
594
+ $fields_list = WPF()->post->get_post_fields_list(false, $forum, !WPF()->current_userid);
595
  foreach ( $args['postmetas'] as $metakey => $metavalue ){
596
  if( in_array( $metakey, $fields_list ) ){
597
  $postmeta = array(
wpf-includes/class-posts.php CHANGED
@@ -276,7 +276,9 @@ class wpForoPost{
276
  }
277
  $args['postid'] = intval($args['postid']);
278
  if( !$post = $this->get_post($args['postid']) ){ WPF()->notice->add('No Posts found for update', 'error'); return FALSE; }
279
-
 
 
280
  if( !is_user_logged_in() ){
281
  if( !isset($post['email']) || !$post['email'] ){
282
  WPF()->notice->add('Permission denied', 'error');
@@ -356,7 +358,7 @@ class wpForoPost{
356
  $post['private'] = $private;
357
  $post['name'] = $name;
358
  $post['email'] = $email;
359
- do_action( 'wpforo_after_edit_post', $post, $args );
360
 
361
  wpforo_clean_cache('post', $postid, $post);
362
  WPF()->notice->add('This post successfully edited', 'success');
@@ -770,16 +772,15 @@ class wpForoPost{
770
  }
771
 
772
  function get_thread_tree( $post, $parents = true ){
773
-
774
- if(!wpfval($post, 'postid') || (wpfkey($post, 'root') && $post['root'] == -1) ) {
775
  return array('posts' => array(), 'parents' => array(), 'count' => 0, 'children' => '' );
776
  }
777
 
778
  $items = array();
779
  $thread = array();
780
- $parentid = $post['postid'];
781
  $type = apply_filters('wpforo_thread_builder_type', 'topic-query'); //'topic-query', 'inside-mysql', 'multi-query'
782
- if( $type == 'topic-query' ) {
783
  if( wpfval($post, 'topicid') ){
784
  $args = array( 'root' => $post['postid'], 'orderby' => '`created` ASC' );
785
  $posts = $this->get_posts( $args, $items_count, false);
@@ -795,30 +796,48 @@ class wpForoPost{
795
  }
796
  }
797
  }
798
- elseif( $type == 'inside-mysql' ){
799
- $mod = ( wpforo_current_user_is('admin') || wpforo_current_user_is('moderator') ) ? true : false;
800
- $sql = "SELECT GROUP_CONCAT( @id := ( SELECT GROUP_CONCAT(postid,'-', parentid, '-', userid, '-', status, '-', email) FROM `" . WPF()->tables->posts . "` WHERE parentid = @id ) ) AS tree
801
- FROM ( SELECT @id := " . intval($parentid) . " ) vars STRAIGHT_JOIN `" . WPF()->tables->posts . "` WHERE @id IS NOT NULL";
802
- if( $posts = WPF()->db->get_var($sql) ){
803
- $posts = explode(',', $posts);
804
- if(!empty($posts)){
805
- foreach($posts as $post) {
806
- $post = explode('-', $post);
807
- if( !$mod && isset($post[3]) && $post[3] ){
808
- if( isset($post[2]) && isset($post[4]) && ( isset(WPF()->current_user['ID']) || isset(WPF()->current_user['user_email']) ) ){
809
- if( WPF()->current_user['ID'] != $post[2] && WPF()->current_user['user_email'] != $post[4] ) continue;
810
- }
811
- }
812
- if( isset($post[0]) && isset($post[1]) ){
813
- $items[$post[0]] = array('postid' => $post[0], 'parentid' => $post[1]);
814
- }
815
- }
816
- $thread = $this->build_thread_data( $parentid, $items );
817
- }
 
 
 
 
818
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
819
  }
820
- elseif( $type == 'multi-query' ) {
821
- $mod = ( wpforo_current_user_is('admin') || wpforo_current_user_is('moderator') ) ? true : false;
822
  $items = $this->get_children( $parentid, $children, $mod );
823
  $thread = $this->build_thread_data( $parentid, $items );
824
  }
@@ -826,7 +845,6 @@ class wpForoPost{
826
  }
827
 
828
  function build_thread_data( $parentid, $items = array(), $count = 0 ){
829
-
830
  $parents = array();
831
  $thread = array('posts' => array(), 'parents' => array(), 'count' => 0, 'children' => '' );
832
 
@@ -1210,12 +1228,74 @@ class wpForoPost{
1210
  }
1211
  }
1212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1213
  /**
1214
  * return post full url by id
1215
  *
1216
  * @since 1.0.0
1217
  *
1218
- * @param mixed $arg
1219
  * @param bool $absolute
1220
  *
1221
  * @return string $url
@@ -1230,70 +1310,24 @@ class wpForoPost{
1230
  }
1231
 
1232
  if ( ! empty( $post ) && is_array( $post ) && !empty($postid) ) {
1233
-
1234
  $forum_slug = (wpfval($post, 'forumid')) ? wpforo_forum($post['forumid'], 'slug') : $this->get_forumslug_byid( $postid );
1235
  $topic_slug = (wpfval($post, 'topicid')) ? wpforo_topic($post['topicid'], 'slug') : $this->get_topicslug_byid( $postid );
1236
 
1237
  $url = $forum_slug . '/' . $topic_slug;
1238
 
1239
- if ( $post['topicid'] ) {
1240
- $layout = WPF()->forum->get_layout( $post['forumid'] );
1241
- $pid = $postid;
1242
- if ( $post['parentid'] ) {
1243
- switch ( $layout ) {
1244
- case 3:
1245
- $pid = $post['parentid'];
1246
- break;
1247
- case 4:
1248
- $pid = $post['root'];
1249
- break;
1250
- }
1251
- }
1252
-
1253
- $where = "";
1254
- $orderby = "`is_first_post` DESC, `created` ASC, `postid` ASC";
1255
- if ( $layout == 3 ) {
1256
- $where .= " AND NOT p.`parentid` ";
1257
- $orderby = "`is_first_post` DESC, `is_answer` DESC, `votes` DESC, `created` ASC, `postid` ASC";
1258
- } elseif ( $layout == 4 ) {
1259
- $where .= " AND NOT p.`parentid` ";
1260
- }
1261
-
1262
- if ( ! wpforo_current_user_is( 'admin' ) && ! wpforo_current_user_is( 'moderator' ) && ! WPF()->perm->forum_can( 'au', $post['forumid'] ) ) {
1263
- if ( WPF()->current_userid ) {
1264
- $where .= " AND ( p.`status` = 0 OR (p.`status` = 1 AND p.`userid` = %d) ) ";
1265
- $where = WPF()->db->prepare( $where, WPF()->current_userid );
1266
- } elseif ( WPF()->current_user_email ) {
1267
- $where .= " AND ( p.`status` = 0 OR (p.`status` = 1 AND p.`email` = %s) ) ";
1268
- $where = WPF()->db->prepare( $where, sanitize_email( WPF()->current_user_email ) );
1269
- } else {
1270
- $where .= " AND NOT p.`status` ";
1271
- }
1272
- }
1273
-
1274
- $sql = "SELECT tmp_view.`rownum` FROM
1275
- (SELECT @rownum := @rownum + 1 AS rownum, p.`postid`
1276
- FROM `" . WPF()->tables->posts . "` p
1277
- CROSS JOIN ( SELECT @rownum := 0 ) AS init_var
1278
- WHERE p.`topicid` = %d
1279
- " . $where . "
1280
- ORDER BY " . $orderby . ") AS tmp_view
1281
- WHERE tmp_view.`postid` = %d";
1282
- $position = wpforo_bigintval( WPF()->db->get_var( WPF()->db->prepare($sql, $post['topicid'], $pid) ) );
1283
-
1284
- $items_per_page = $this->get_option_items_per_page($layout);
1285
 
1286
- if ( $position <= $items_per_page ) {
1287
- return wpforo_home_url( $url, false, $absolute ) . "#post-" . wpforo_bigintval( $postid );
1288
- }
1289
- if ( $position && $items_per_page ) {
1290
- $paged = ceil( $position / $items_per_page );
1291
- } else {
1292
- $paged = 1;
1293
- }
1294
-
1295
- return wpforo_home_url( $url . "/" . wpforo_get_template_slug('paged') . "/" . $paged, false, $absolute ) . "#post-" . wpforo_bigintval( $postid );
1296
  }
 
 
1297
  }
1298
 
1299
  return wpforo_home_url();
@@ -1310,16 +1344,40 @@ class wpForoPost{
1310
  */
1311
  function is_answered( $postid ) {
1312
  $is_answered = WPF()->db->get_var( WPF()->db->prepare(
1313
- " SELECT is_answer
1314
- FROM `" . WPF()->tables->posts . "`
1315
- WHERE postid = %d
1316
- ",
1317
  $postid
1318
  ) );
1319
-
1320
  return $is_answered;
1321
  }
1322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1323
  function is_approved( $postid ){
1324
  $post = WPF()->db->get_var( "SELECT `status` FROM ".WPF()->tables->posts." WHERE `postid` = " . intval($postid) );
1325
  if( $post ) return FALSE;
@@ -1555,18 +1613,22 @@ class wpForoPost{
1555
  return $unread_posts;
1556
  }
1557
 
1558
- public function reset_fields(){
1559
- $this->fields = array();
 
 
 
 
1560
  }
1561
 
1562
- private function init_fields( $forum = array() ){
1563
- if( $this->fields ) return;
1564
  $all_groupids = WPF()->usergroup->get_usergroups('groupid');
1565
  $all_groupids = array_map('intval', $all_groupids);
1566
 
1567
- $this->fields = apply_filters( 'wpforo_post_before_init_fields', $this->fields );
1568
 
1569
- $this->fields['title'] = array(
1570
  'fieldKey' => 'title',
1571
  'type' => 'text',
1572
  'isDefault' => 1,
@@ -1587,7 +1649,7 @@ class wpForoPost{
1587
  'isSearchable' => 1
1588
  );
1589
 
1590
- /*$this->fields['slug'] = array(
1591
  'fieldKey' => 'slug',
1592
  'type' => 'text',
1593
  'isDefault' => 1,
@@ -1608,7 +1670,7 @@ class wpForoPost{
1608
  'isSearchable' => 1
1609
  );*/
1610
 
1611
- $this->fields['body'] = array(
1612
  'fieldKey' => 'body',
1613
  'type' => 'tinymce',
1614
  'isDefault' => 1,
@@ -1628,7 +1690,7 @@ class wpForoPost{
1628
  'isSearchable' => 1
1629
  );
1630
 
1631
- $this->fields['name'] = array(
1632
  'fieldKey' => 'name',
1633
  'type' => 'text',
1634
  'isDefault' => 1,
@@ -1646,11 +1708,11 @@ class wpForoPost{
1646
  'canEdit' => $all_groupids,
1647
  'canView' => $all_groupids,
1648
  'can' => '',
1649
- 'isSearchable' => 1,
1650
  'isOnlyForGuests' => 1
1651
  );
1652
 
1653
- $this->fields['email'] = array(
1654
  'fieldKey' => 'email',
1655
  'type' => 'text',
1656
  'isDefault' => 1,
@@ -1668,11 +1730,11 @@ class wpForoPost{
1668
  'canEdit' => $all_groupids,
1669
  'canView' => $all_groupids,
1670
  'can' => '',
1671
- 'isSearchable' => 1,
1672
  'isOnlyForGuests' => 1
1673
  );
1674
 
1675
- /*$this->fields['tags'] = array(
1676
  'fieldKey' => 'tags',
1677
  'type' => 'text',
1678
  'isDefault' => 1,
@@ -1693,7 +1755,7 @@ class wpForoPost{
1693
  'isSearchable' => 1
1694
  );
1695
 
1696
- $this->fields['sticky'] = array(
1697
  'fieldKey' => 'sticky',
1698
  'type' => 'checkbox',
1699
  'isDefault' => 1,
@@ -1713,7 +1775,7 @@ class wpForoPost{
1713
  'isSearchable' => 1
1714
  );
1715
 
1716
- $this->fields['private'] = array(
1717
  'fieldKey' => 'private',
1718
  'type' => 'checkbox',
1719
  'isDefault' => 1,
@@ -1733,7 +1795,7 @@ class wpForoPost{
1733
  'isSearchable' => 1
1734
  );
1735
 
1736
- $this->fields['subscribe'] = array(
1737
  'fieldKey' => 'subscribe',
1738
  'type' => 'checkbox',
1739
  'isDefault' => 1,
@@ -1753,9 +1815,9 @@ class wpForoPost{
1753
  'isSearchable' => 0
1754
  );*/
1755
 
1756
- $this->fields = (array) apply_filters( 'wpforo_post_after_init_fields', $this->fields, $forum );
1757
 
1758
- $this->fields = array_map(array($this, 'fix_field'), $this->fields);
1759
  }
1760
 
1761
  public function fix_field($field){
@@ -1764,17 +1826,17 @@ class wpForoPost{
1764
  return $field;
1765
  }
1766
 
1767
- public function get_fields($only_defaults = false, $forum = array()){
1768
- $this->init_fields($forum);
1769
- $fields = $this->fields;
1770
  if($only_defaults) foreach ($fields as $k => $v) if( !wpfval($v, 'isDefault') ) unset($fields[$k]);
1771
  return $fields;
1772
  }
1773
 
1774
- public function get_field($key, $forum = array()){
1775
  if( is_string($key) ){
1776
- $this->init_fields($forum);
1777
- return (array) wpfval($this->fields, $key);
1778
  }elseif( $this->is_field($key) ){
1779
  return $key;
1780
  }
@@ -1789,7 +1851,7 @@ class wpForoPost{
1789
  return is_string($field) ? $field : (string) wpfval($field, 'fieldKey');
1790
  }
1791
 
1792
- public function fields_structure_full_array($fields, &$used_fields = array(), $forum = array() ){
1793
  if(is_string($fields)) $fields = maybe_unserialize($fields);
1794
  $fs = array(array(array()));
1795
  if(!is_array($fields)) return $fs;
@@ -1799,7 +1861,7 @@ class wpForoPost{
1799
  if( is_array($cols) ){
1800
  foreach( $cols as $kf => $field ){
1801
  $used_fields[] = $field_key = $this->get_field_key($field);
1802
- $fs[$kr][$kc][$field_key] = $this->get_field($field, $forum);
1803
  }
1804
  }
1805
  }
@@ -1820,9 +1882,9 @@ class wpForoPost{
1820
  }
1821
 
1822
  public function get_topic_fields($forum, $values = array(), $guest = false ){
1823
- $fields = $this->fields_structure_full_array( $this->get_topic_fields_structure(false, $forum, $guest), $used_fields, $forum );
1824
- if( !in_array('title', $used_fields, true) ) $fields[][][] = $this->get_field('title', $forum);
1825
- if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body', $forum);
1826
 
1827
  /**
1828
  * apply old options to fields
@@ -1897,19 +1959,19 @@ class wpForoPost{
1897
  // -- END -- get topic fields
1898
 
1899
  // -- START -- get post fields
1900
- public function get_post_fields_structure($only_defaults = false, $layout = 1, $guest = false){
1901
  if( $guest ) {
1902
  $fields[0][0][0] = 'name';
1903
  $fields[0][1][0] = 'email';
1904
  }
1905
  $fields[][] = array('title','body');
1906
- if(!$only_defaults) $fields = apply_filters('wpforo_get_post_fields_structure', $fields, $layout, $guest);
1907
  return $fields;
1908
  }
1909
 
1910
- public function get_post_fields($topic, $values = array(), $guest = false){
1911
- $fields = $this->fields_structure_full_array( $this->get_post_fields_structure(false, $topic['layout'], $guest), $used_fields );
1912
- if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body');
1913
 
1914
  /**
1915
  * apply old options to fields
@@ -1928,8 +1990,8 @@ class wpForoPost{
1928
  $field['textareaid'] = uniqid('wpf_post_body_');
1929
  $field['minLength'] = $this->options['post_body_min_length'];
1930
  $field['maxLength'] = $this->options['post_body_max_length'];
1931
- $field['form_type'] = 'reply';
1932
- $field['meta'] = array('topic' => $topic, 'values' => $values);
1933
  break;
1934
  case 'title':
1935
  $prefix_answer = wpforo_phrase('Answer to', false, 'default');
@@ -1938,7 +2000,7 @@ class wpForoPost{
1938
  $pattern = array_map('preg_quote', $prefix_patterns);
1939
  $pattern = implode('|', $pattern);
1940
  $title = preg_replace('#^\s*(?:'. $pattern .')\s*: #isu', '', trim($field['value']), 1);
1941
- if( intval($topic['layout']) === 3 ) {
1942
  $field['label'] = wpforo_phrase( 'Your question', false );
1943
  if($title) $field['value'] = $prefix_answer . ': ' . $title;
1944
  }else{
@@ -1961,7 +2023,7 @@ class wpForoPost{
1961
  $field = array();
1962
  }
1963
  }
1964
- $fields[$kr][$kc][$kf] = apply_filters( 'wpforo_post_field', $field, $topic, $values, $guest );
1965
  }
1966
  }
1967
  }
@@ -1970,9 +2032,9 @@ class wpForoPost{
1970
  return $fields;
1971
  }
1972
 
1973
- public function get_post_fields_list($only_defaults = false, $layout = 1, $guest = false){
1974
  $fields_list = array('body');
1975
- $fields_structure = $this->get_post_fields_structure($only_defaults, $layout, $guest);
1976
  foreach ( $fields_structure as $r ){
1977
  foreach ( $r as $c ){
1978
  foreach ($c as $f){
@@ -1983,116 +2045,116 @@ class wpForoPost{
1983
  return array_values(array_unique($fields_list));
1984
  }
1985
  // -- END -- get post fields
1986
-
1987
- // -- START -- get QA comment fields
1988
- public function get_comment_fields_structure($only_defaults = false, $guest = false){
1989
- if( $guest ) {
1990
- $fields[0][0][0] = 'name';
1991
- $fields[0][1][0] = 'email';
1992
- }
1993
- $fields[][] = array('body');
1994
- if(!$only_defaults) $fields = apply_filters('wpforo_get_comment_fields_structure', $fields, $guest);
1995
- return $fields;
1996
- }
1997
-
1998
- public function get_comment_fields($only_defaults = false, $guest = false){
1999
- $fields = $this->fields_structure_full_array( $this->get_comment_fields_structure($only_defaults, $guest), $used_fields );
2000
- if( !$only_defaults ){
2001
- if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body');
2002
- }
2003
-
2004
- /**
2005
- * apply old options to fields
2006
- */
2007
- foreach( $fields as $kr => $row ){
2008
- foreach( $row as $kc => $cols ){
2009
- foreach( $cols as $kf => $field ){
2010
- if( $kf === 'body' && $field ){
2011
- if( $field['type'] === 'tinymce' ) $field['wp_editor_settings'] = WPF()->tpl->editor_buttons('post');
2012
- $field['type'] = WPF()->tpl->forms['qa_comments_rich_editor'] ? 'tinymce' : 'textarea';
2013
- $field['textareaid'] = uniqid('wpf_post_body_');
2014
- $field['minLength'] = $this->options['comment_body_min_length'];
2015
- $field['maxLength'] = $this->options['comment_body_max_length'];
2016
- $fields[$kr][$kc][$kf] = $field;
2017
- }
2018
- }
2019
- }
2020
- }
2021
-
2022
- return $fields;
2023
- }
2024
-
2025
- public function get_comment_fields_list($only_defaults = false, $guest = false){
2026
- $fields_list = array('body');
2027
- $fields_structure = $this->get_comment_fields_structure($only_defaults, $guest);
2028
- foreach ( $fields_structure as $r ){
2029
- foreach ( $r as $c ){
2030
- foreach ($c as $f){
2031
- $fields_list[] = $f;
2032
- }
2033
- }
2034
- }
2035
- return array_values(array_unique($fields_list));
2036
- }
2037
- // -- END -- get QA comment fields
2038
-
2039
- // -- START -- get threaded reply fields
2040
- public function get_reply_fields_structure($only_defaults = false, $guest = false){
2041
- if( $guest ) {
2042
- $fields[0][0][0] = 'name';
2043
- $fields[0][1][0] = 'email';
2044
- }
2045
- $fields[][] = array('body');
2046
- if(!$only_defaults) $fields = apply_filters('wpforo_get_reply_fields_structure', $fields, $guest);
2047
- return $fields;
2048
- }
2049
-
2050
- public function get_reply_fields($only_defaults = false, $guest = false){
2051
- $fields = $this->fields_structure_full_array( $this->get_reply_fields_structure($only_defaults, $guest), $used_fields );
2052
- if( !$only_defaults ){
2053
- if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body');
2054
- }
2055
-
2056
- /**
2057
- * apply old options to fields
2058
- */
2059
- foreach( $fields as $kr => $row ){
2060
- foreach( $row as $kc => $cols ){
2061
- foreach( $cols as $kf => $field ){
2062
- if( $kf === 'body' && $field ){
2063
- if( $field['type'] === 'tinymce' ) $field['wp_editor_settings'] = WPF()->tpl->editor_buttons('post');
2064
- $field['type'] = WPF()->tpl->forms['threaded_reply_rich_editor'] ? 'tinymce' : 'textarea';
2065
- $field['textareaid'] = uniqid('wpf_post_body_');
2066
- $field['minLength'] = $this->options['post_body_min_length'];
2067
- $field['maxLength'] = $this->options['post_body_max_length'];
2068
- $fields[$kr][$kc][$kf] = $field;
2069
- }
2070
- }
2071
- }
2072
- }
2073
-
2074
- return $fields;
2075
- }
2076
-
2077
- public function get_reply_fields_list($only_defaults = false, $guest = false){
2078
- $fields_list = array('body');
2079
- $fields_structure = $this->get_reply_fields_structure($only_defaults, $guest);
2080
- foreach ( $fields_structure as $r ){
2081
- foreach ( $r as $c ){
2082
- foreach ($c as $f){
2083
- $fields_list[] = $f;
2084
- }
2085
- }
2086
- }
2087
- return array_values(array_unique($fields_list));
2088
- }
2089
- // -- END -- get threaded reply fields
2090
 
2091
  public function get_search_fields($values){
2092
  $values = (array) $values;
2093
  $values = wp_slash($values);
2094
 
2095
- $topic_fields = WPF()->post->get_topic_fields_list();
2096
  $topic_fields = array_flip($topic_fields);
2097
  $fields = $this->get_fields();
2098
  $fields = array_intersect_key($fields, $topic_fields);
@@ -2113,10 +2175,10 @@ class wpForoPost{
2113
  $content .= '<div class="wpf-topic-fields">';
2114
  $content .= apply_filters('wpforo_topic_fields_before', '', $post);
2115
  $forum = WPF()->forum->get_forum($post['forumid']);
2116
- $fields = WPF()->post->get_topic_fields_list(false, $forum);
2117
  foreach ( $fields as $field ){
2118
  if( $postmeta = wpfval($postmetas, $field) ){
2119
- $field = WPF()->post->get_field($field, $forum);
2120
  if( !(int) wpfval($field, 'isDefault') ){
2121
  $field['value'] = $postmeta;
2122
  $field = WPF()->form->prepare_values( WPF()->form->esc_field($field) );
276
  }
277
  $args['postid'] = intval($args['postid']);
278
  if( !$post = $this->get_post($args['postid']) ){ WPF()->notice->add('No Posts found for update', 'error'); return FALSE; }
279
+ if( !$topic = WPF()->topic->get_topic($post['topicid']) ){ WPF()->notice->add('No Topic found for update', 'error'); return FALSE; }
280
+ if( !$forum = WPF()->forum->get_forum($topic['forumid']) ){ WPF()->notice->add('No Forum found for update', 'error'); return FALSE; }
281
+
282
  if( !is_user_logged_in() ){
283
  if( !isset($post['email']) || !$post['email'] ){
284
  WPF()->notice->add('Permission denied', 'error');
358
  $post['private'] = $private;
359
  $post['name'] = $name;
360
  $post['email'] = $email;
361
+ do_action( 'wpforo_after_edit_post', $post, $topic, $forum, $args );
362
 
363
  wpforo_clean_cache('post', $postid, $post);
364
  WPF()->notice->add('This post successfully edited', 'success');
772
  }
773
 
774
  function get_thread_tree( $post, $parents = true ){
775
+ if( !wpfval($post, 'postid') || (wpfkey($post, 'root') && $post['root'] == -1) ) {
 
776
  return array('posts' => array(), 'parents' => array(), 'count' => 0, 'children' => '' );
777
  }
778
 
779
  $items = array();
780
  $thread = array();
781
+ $parentid = (int) $post['postid'];
782
  $type = apply_filters('wpforo_thread_builder_type', 'topic-query'); //'topic-query', 'inside-mysql', 'multi-query'
783
+ if( $type === 'topic-query' ) {
784
  if( wpfval($post, 'topicid') ){
785
  $args = array( 'root' => $post['postid'], 'orderby' => '`created` ASC' );
786
  $posts = $this->get_posts( $args, $items_count, false);
796
  }
797
  }
798
  }
799
+ elseif( $type === 'inside-mysql' ){
800
+ $mod = wpforo_current_user_is('admin') || wpforo_current_user_is('moderator');
801
+ if( version_compare( WPF()->db->db_version(), '8.0.0', '>=' ) ){
802
+ $sql = "WITH RECURSIVE `post_path` AS (
803
+ SELECT `postid`, `parentid`, `userid`, `status`, `email`
804
+ FROM `" . WPF()->tables->posts . "`
805
+ WHERE `parentid` = %d
806
+ UNION
807
+ SELECT p.`postid`, p.`parentid`, p.`userid`, p.`status`, p.`email`
808
+ FROM `" . WPF()->tables->posts . "` p
809
+ INNER JOIN `post_path` pp ON pp.`postid` = p.`parentid`
810
+ ) SELECT CONCAT( `postid`, '-', `parentid`, '-', `userid`, '-', `status`, '-', `email` ) AS tree FROM `post_path`";
811
+ $posts = (array) WPF()->db->get_col( WPF()->db->prepare( $sql, $parentid ) );
812
+ }else{
813
+ $sql = "SELECT GROUP_CONCAT( @id := (
814
+ SELECT GROUP_CONCAT(postid,'-', parentid, '-', userid, '-', status, '-', email)
815
+ FROM `" . WPF()->tables->posts . "`
816
+ WHERE parentid = @id
817
+ )
818
+ ) AS tree
819
+ FROM ( SELECT @id := %d ) vars
820
+ STRAIGHT_JOIN `" . WPF()->tables->posts . "`
821
+ WHERE @id IS NOT NULL";
822
+ $posts = explode(',', (string) WPF()->db->get_var( WPF()->db->prepare( $sql, $parentid ) ));
823
  }
824
+ if(!empty($posts)){
825
+ foreach($posts as $post) {
826
+ $post = explode('-', $post);
827
+ if( !$mod && isset($post[3]) && $post[3] ){
828
+ if( isset($post[2]) && isset($post[4]) && ( isset(WPF()->current_user['ID']) || isset(WPF()->current_user['user_email']) ) ){
829
+ if( WPF()->current_user['ID'] != $post[2] && WPF()->current_user['user_email'] != $post[4] ) continue;
830
+ }
831
+ }
832
+ if( isset($post[0]) && isset($post[1]) ){
833
+ $items[$post[0]] = array('postid' => $post[0], 'parentid' => $post[1]);
834
+ }
835
+ }
836
+ $thread = $this->build_thread_data( $parentid, $items );
837
+ }
838
  }
839
+ elseif( $type === 'multi-query' ) {
840
+ $mod = wpforo_current_user_is('admin') || wpforo_current_user_is('moderator');
841
  $items = $this->get_children( $parentid, $children, $mod );
842
  $thread = $this->build_thread_data( $parentid, $items );
843
  }
845
  }
846
 
847
  function build_thread_data( $parentid, $items = array(), $count = 0 ){
 
848
  $parents = array();
849
  $thread = array('posts' => array(), 'parents' => array(), 'count' => 0, 'children' => '' );
850
 
1228
  }
1229
  }
1230
 
1231
+ /**
1232
+ * @param array $post the array of wpforo post
1233
+ *
1234
+ * @return int
1235
+ */
1236
+ private function get_position_in_topic($post){
1237
+ $layout = WPF()->forum->get_layout( $post['forumid'] );
1238
+ $pid = $post['postid'];
1239
+ if ( $post['parentid'] ) {
1240
+ switch ( $layout ) {
1241
+ case 3:
1242
+ $pid = $post['parentid'];
1243
+ break;
1244
+ case 4:
1245
+ $pid = $post['root'];
1246
+ break;
1247
+ }
1248
+ }
1249
+
1250
+ $where = "";
1251
+ $orderby = "`is_first_post` DESC, `created` ASC, `postid` ASC";
1252
+ if ( $layout === 3 ) {
1253
+ $where .= " AND NOT p.`parentid` ";
1254
+ $orderby = "`is_first_post` DESC, `is_answer` DESC, `votes` DESC, `created` ASC, `postid` ASC";
1255
+ } elseif ( $layout === 4 ) {
1256
+ $where .= " AND NOT p.`parentid` ";
1257
+ }
1258
+
1259
+ if ( ! wpforo_current_user_is( 'admin' ) && ! wpforo_current_user_is( 'moderator' ) && ! WPF()->perm->forum_can( 'au', $post['forumid'] ) ) {
1260
+ if ( WPF()->current_userid ) {
1261
+ $where .= " AND ( p.`status` = 0 OR (p.`status` = 1 AND p.`userid` = %d) ) ";
1262
+ $where = WPF()->db->prepare( $where, WPF()->current_userid );
1263
+ } elseif ( WPF()->current_user_email ) {
1264
+ $where .= " AND ( p.`status` = 0 OR (p.`status` = 1 AND p.`email` = %s) ) ";
1265
+ $where = WPF()->db->prepare( $where, sanitize_email( WPF()->current_user_email ) );
1266
+ } else {
1267
+ $where .= " AND NOT p.`status` ";
1268
+ }
1269
+ }
1270
+
1271
+ if ( version_compare( WPF()->db->db_version(), '8.0.0', '>=' ) ) {
1272
+ $sql = "SELECT tmp_view.`rownum` FROM
1273
+ (SELECT ROW_NUMBER() OVER() AS rownum, p.`postid`
1274
+ FROM `" . WPF()->tables->posts . "` p
1275
+ WHERE p.`topicid` = %d
1276
+ " . $where . "
1277
+ ORDER BY " . $orderby . ") AS tmp_view
1278
+ WHERE tmp_view.`postid` = %d";
1279
+ }else{
1280
+ $sql = "SELECT tmp_view.`rownum` FROM
1281
+ (SELECT @rownum := @rownum + 1 AS rownum, p.`postid`
1282
+ FROM `" . WPF()->tables->posts . "` p
1283
+ CROSS JOIN ( SELECT @rownum := 0 ) AS init_var
1284
+ WHERE p.`topicid` = %d
1285
+ " . $where . "
1286
+ ORDER BY " . $orderby . ") AS tmp_view
1287
+ WHERE tmp_view.`postid` = %d";
1288
+ }
1289
+ $sql = WPF()->db->prepare($sql, $post['topicid'], $pid);
1290
+ return (int) WPF()->db->get_var( $sql );
1291
+ }
1292
+
1293
  /**
1294
  * return post full url by id
1295
  *
1296
  * @since 1.0.0
1297
  *
1298
+ * @param int|array $arg
1299
  * @param bool $absolute
1300
  *
1301
  * @return string $url
1310
  }
1311
 
1312
  if ( ! empty( $post ) && is_array( $post ) && !empty($postid) ) {
 
1313
  $forum_slug = (wpfval($post, 'forumid')) ? wpforo_forum($post['forumid'], 'slug') : $this->get_forumslug_byid( $postid );
1314
  $topic_slug = (wpfval($post, 'topicid')) ? wpforo_topic($post['topicid'], 'slug') : $this->get_topicslug_byid( $postid );
1315
 
1316
  $url = $forum_slug . '/' . $topic_slug;
1317
 
1318
+ $position = $this->get_position_in_topic($post);
1319
+ $items_per_page = $this->get_option_items_per_page( WPF()->forum->get_layout( $post['forumid'] ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1320
 
1321
+ if ( $position <= $items_per_page ) {
1322
+ return wpforo_home_url( $url, false, $absolute ) . "#post-" . wpforo_bigintval( $postid );
1323
+ }
1324
+ if ( $position && $items_per_page ) {
1325
+ $paged = ceil( $position / $items_per_page );
1326
+ } else {
1327
+ $paged = 1;
 
 
 
1328
  }
1329
+
1330
+ return wpforo_home_url( $url . "/" . wpforo_get_template_slug('paged') . "/" . $paged, false, $absolute ) . "#post-" . wpforo_bigintval( $postid );
1331
  }
1332
 
1333
  return wpforo_home_url();
1344
  */
1345
  function is_answered( $postid ) {
1346
  $is_answered = WPF()->db->get_var( WPF()->db->prepare(
1347
+ "SELECT is_answer FROM `" . WPF()->tables->posts . "` WHERE postid = %d",
 
 
 
1348
  $postid
1349
  ) );
 
1350
  return $is_answered;
1351
  }
1352
 
1353
+ function get_best_answer( $topicid, $extended = true ){
1354
+ $best_answer = array();
1355
+ $args = array( 'topicid' => $topicid,
1356
+ 'is_answer' => 1,
1357
+ 'status' => 0);
1358
+ $best_answers = $this->get_posts($args);
1359
+ if( !empty($best_answers) && isset($best_answers[0]) ){
1360
+ $best_answer = $best_answers[0];
1361
+ } else if( $extended ){
1362
+ $best_answer = WPF()->db->get_row( WPF()->db->prepare(
1363
+ "SELECT * FROM `" . WPF()->tables->posts . "` WHERE `topicid` = %d AND `is_first_post` = 0 AND `parentid` = 0 AND `votes` > 0 ORDER BY `votes` DESC LIMIT 1",
1364
+ $topicid
1365
+ ), ARRAY_A );
1366
+ }
1367
+ return $best_answer;
1368
+ }
1369
+
1370
+ function get_suggested_answers( $topicid, $count = 3 ){
1371
+ $args = array( 'topicid' => $topicid,
1372
+ 'is_first_post' => 0,
1373
+ 'parentid' => 0,
1374
+ 'is_answer' => 0,
1375
+ 'orderby' => '`votes` DESC, `created` ASC',
1376
+ 'row_count' => $count,
1377
+ 'status' => 0);
1378
+ return $this->get_posts($args);
1379
+ }
1380
+
1381
  function is_approved( $postid ){
1382
  $post = WPF()->db->get_var( "SELECT `status` FROM ".WPF()->tables->posts." WHERE `postid` = " . intval($postid) );
1383
  if( $post ) return FALSE;
1613
  return $unread_posts;
1614
  }
1615
 
1616
+ public function reset_fields( $type = null ){
1617
+ if( is_null( $type ) ){
1618
+ $this->fields = array();
1619
+ }else{
1620
+ unset($this->fields, $type);
1621
+ }
1622
  }
1623
 
1624
+ private function init_fields( $type, $forum = array() ){
1625
+ if( $fields = (array) wpfval( $this->fields, $type ) ) return;
1626
  $all_groupids = WPF()->usergroup->get_usergroups('groupid');
1627
  $all_groupids = array_map('intval', $all_groupids);
1628
 
1629
+ $fields = apply_filters( 'wpforo_post_before_init_fields', $fields );
1630
 
1631
+ $fields['title'] = array(
1632
  'fieldKey' => 'title',
1633
  'type' => 'text',
1634
  'isDefault' => 1,
1649
  'isSearchable' => 1
1650
  );
1651
 
1652
+ /*$fields['slug'] = array(
1653
  'fieldKey' => 'slug',
1654
  'type' => 'text',
1655
  'isDefault' => 1,
1670
  'isSearchable' => 1
1671
  );*/
1672
 
1673
+ $fields['body'] = array(
1674
  'fieldKey' => 'body',
1675
  'type' => 'tinymce',
1676
  'isDefault' => 1,
1690
  'isSearchable' => 1
1691
  );
1692
 
1693
+ $fields['name'] = array(
1694
  'fieldKey' => 'name',
1695
  'type' => 'text',
1696
  'isDefault' => 1,
1708
  'canEdit' => $all_groupids,
1709
  'canView' => $all_groupids,
1710
  'can' => '',
1711
+ 'isSearchable' => 0,
1712
  'isOnlyForGuests' => 1
1713
  );
1714
 
1715
+ $fields['email'] = array(
1716
  'fieldKey' => 'email',
1717
  'type' => 'text',
1718
  'isDefault' => 1,
1730
  'canEdit' => $all_groupids,
1731
  'canView' => $all_groupids,
1732
  'can' => '',
1733
+ 'isSearchable' => 0,
1734
  'isOnlyForGuests' => 1
1735
  );
1736
 
1737
+ /*$fields['tags'] = array(
1738
  'fieldKey' => 'tags',
1739
  'type' => 'text',
1740
  'isDefault' => 1,
1755
  'isSearchable' => 1
1756
  );
1757
 
1758
+ $fields['sticky'] = array(
1759
  'fieldKey' => 'sticky',
1760
  'type' => 'checkbox',
1761
  'isDefault' => 1,
1775
  'isSearchable' => 1
1776
  );
1777
 
1778
+ $fields['private'] = array(
1779
  'fieldKey' => 'private',
1780
  'type' => 'checkbox',
1781
  'isDefault' => 1,
1795
  'isSearchable' => 1
1796
  );
1797
 
1798
+ $fields['subscribe'] = array(
1799
  'fieldKey' => 'subscribe',
1800
  'type' => 'checkbox',
1801
  'isDefault' => 1,
1815
  'isSearchable' => 0
1816
  );*/
1817
 
1818
+ $fields = (array) apply_filters( 'wpforo_post_after_init_fields', $fields, $type, $forum );
1819
 
1820
+ $this->fields[$type] = array_map(array($this, 'fix_field'), $fields);
1821
  }
1822
 
1823
  public function fix_field($field){
1826
  return $field;
1827
  }
1828
 
1829
+ public function get_fields($only_defaults = false, $type = 'topic', $forum = array()){
1830
+ $this->init_fields($type, $forum);
1831
+ $fields = (array) wpfval( $this->fields, $type );
1832
  if($only_defaults) foreach ($fields as $k => $v) if( !wpfval($v, 'isDefault') ) unset($fields[$k]);
1833
  return $fields;
1834
  }
1835
 
1836
+ public function get_field($key, $type = 'topic', $forum = array()){
1837
  if( is_string($key) ){
1838
+ $this->init_fields($type, $forum);
1839
+ return (array) wpfval($this->fields, $type, $key);
1840
  }elseif( $this->is_field($key) ){
1841
  return $key;
1842
  }
1851
  return is_string($field) ? $field : (string) wpfval($field, 'fieldKey');
1852
  }
1853
 
1854
+ public function fields_structure_full_array( $fields, &$used_fields = array(), $type = 'topic', $forum = array() ){
1855
  if(is_string($fields)) $fields = maybe_unserialize($fields);
1856
  $fs = array(array(array()));
1857
  if(!is_array($fields)) return $fs;
1861
  if( is_array($cols) ){
1862
  foreach( $cols as $kf => $field ){
1863
  $used_fields[] = $field_key = $this->get_field_key($field);
1864
+ $fs[$kr][$kc][$field_key] = $this->get_field($field, $type, $forum);
1865
  }
1866
  }
1867
  }
1882
  }
1883
 
1884
  public function get_topic_fields($forum, $values = array(), $guest = false ){
1885
+ $fields = $this->fields_structure_full_array( $this->get_topic_fields_structure(false, $forum, $guest), $used_fields, 'topic', $forum );
1886
+ if( !in_array('title', $used_fields, true) ) $fields[][][] = $this->get_field('title', 'topic', $forum);
1887
+ if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body', 'topic', $forum);
1888
 
1889
  /**
1890
  * apply old options to fields
1959
  // -- END -- get topic fields
1960
 
1961
  // -- START -- get post fields
1962
+ public function get_post_fields_structure($only_defaults = false, $forum = array(), $guest = false){
1963
  if( $guest ) {
1964
  $fields[0][0][0] = 'name';
1965
  $fields[0][1][0] = 'email';
1966
  }
1967
  $fields[][] = array('title','body');
1968
+ if(!$only_defaults) $fields = apply_filters('wpforo_get_post_fields_structure', $fields, $forum, $guest);
1969
  return $fields;
1970
  }
1971
 
1972
+ public function get_post_fields($forum, $topic, $values = array(), $guest = false){
1973
+ $fields = $this->fields_structure_full_array( $this->get_post_fields_structure(false, $forum, $guest), $used_fields, 'post', $forum );
1974
+ if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body', 'post', $forum);
1975
 
1976
  /**
1977
  * apply old options to fields
1990
  $field['textareaid'] = uniqid('wpf_post_body_');
1991
  $field['minLength'] = $this->options['post_body_min_length'];
1992
  $field['maxLength'] = $this->options['post_body_max_length'];
1993
+ $field['form_type'] = 'post';
1994
+ $field['meta'] = array('forum' => $forum, 'topic' => $topic, 'values' => $values);
1995
  break;
1996
  case 'title':
1997
  $prefix_answer = wpforo_phrase('Answer to', false, 'default');
2000
  $pattern = array_map('preg_quote', $prefix_patterns);
2001
  $pattern = implode('|', $pattern);
2002
  $title = preg_replace('#^\s*(?:'. $pattern .')\s*: #isu', '', trim($field['value']), 1);
2003
+ if( WPF()->forum->get_layout($forum) === 3 ) {
2004
  $field['label'] = wpforo_phrase( 'Your question', false );
2005
  if($title) $field['value'] = $prefix_answer . ': ' . $title;
2006
  }else{
2023
  $field = array();
2024
  }
2025
  }
2026
+ $fields[$kr][$kc][$kf] = apply_filters( 'wpforo_post_field', $field, $forum, $topic, $values, $guest );
2027
  }
2028
  }
2029
  }
2032
  return $fields;
2033
  }
2034
 
2035
+ public function get_post_fields_list($only_defaults = false, $forum = array(), $guest = false){
2036
  $fields_list = array('body');
2037
+ $fields_structure = $this->get_post_fields_structure($only_defaults, $forum, $guest);
2038
  foreach ( $fields_structure as $r ){
2039
  foreach ( $r as $c ){
2040
  foreach ($c as $f){
2045
  return array_values(array_unique($fields_list));
2046
  }
2047
  // -- END -- get post fields
2048
+ //
2049
+ // // -- START -- get QA comment fields
2050
+ // public function get_comment_fields_structure($only_defaults = false, $guest = false){
2051
+ // if( $guest ) {
2052
+ // $fields[0][0][0] = 'name';
2053
+ // $fields[0][1][0] = 'email';
2054
+ // }
2055
+ // $fields[][] = array('body');
2056
+ // if(!$only_defaults) $fields = apply_filters('wpforo_get_comment_fields_structure', $fields, $guest);
2057
+ // return $fields;
2058
+ // }
2059
+ //
2060
+ // public function get_comment_fields($only_defaults = false, $guest = false){
2061
+ // $fields = $this->fields_structure_full_array( $this->get_comment_fields_structure($only_defaults, $guest), $used_fields, 'comment' );
2062
+ // if( !$only_defaults ){
2063
+ // if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body', 'comment');
2064
+ // }
2065
+ //
2066
+ // /**
2067
+ // * apply old options to fields
2068
+ // */
2069
+ // foreach( $fields as $kr => $row ){
2070
+ // foreach( $row as $kc => $cols ){
2071
+ // foreach( $cols as $kf => $field ){
2072
+ // if( $kf === 'body' && $field ){
2073
+ // if( $field['type'] === 'tinymce' ) $field['wp_editor_settings'] = WPF()->tpl->editor_buttons('post');
2074
+ // $field['type'] = WPF()->tpl->forms['qa_comments_rich_editor'] ? 'tinymce' : 'textarea';
2075
+ // $field['textareaid'] = uniqid('wpf_post_body_');
2076
+ // $field['minLength'] = $this->options['comment_body_min_length'];
2077
+ // $field['maxLength'] = $this->options['comment_body_max_length'];
2078
+ // $fields[$kr][$kc][$kf] = $field;
2079
+ // }
2080
+ // }
2081
+ // }
2082
+ // }
2083
+ //
2084
+ // return $fields;
2085
+ // }
2086
+ //
2087
+ // public function get_comment_fields_list($only_defaults = false, $guest = false){
2088
+ // $fields_list = array('body');
2089
+ // $fields_structure = $this->get_comment_fields_structure($only_defaults, $guest);
2090
+ // foreach ( $fields_structure as $r ){
2091
+ // foreach ( $r as $c ){
2092
+ // foreach ($c as $f){
2093
+ // $fields_list[] = $f;
2094
+ // }
2095
+ // }
2096
+ // }
2097
+ // return array_values(array_unique($fields_list));
2098
+ // }
2099
+ // // -- END -- get QA comment fields
2100
+ //
2101
+ // // -- START -- get threaded reply fields
2102
+ // public function get_reply_fields_structure($only_defaults = false, $guest = false){
2103
+ // if( $guest ) {
2104
+ // $fields[0][0][0] = 'name';
2105
+ // $fields[0][1][0] = 'email';
2106
+ // }
2107
+ // $fields[][] = array('body');
2108
+ // if(!$only_defaults) $fields = apply_filters('wpforo_get_reply_fields_structure', $fields, $guest);
2109
+ // return $fields;
2110
+ // }
2111
+ //
2112
+ // public function get_reply_fields($only_defaults = false, $guest = false){
2113
+ // $fields = $this->fields_structure_full_array( $this->get_reply_fields_structure($only_defaults, $guest), $used_fields, 'reply' );
2114
+ // if( !$only_defaults ){
2115
+ // if( !in_array('body', $used_fields, true) ) $fields[][][] = $this->get_field('body', 'reply');
2116
+ // }
2117
+ //
2118
+ // /**
2119
+ // * apply old options to fields
2120
+ // */
2121
+ // foreach( $fields as $kr => $row ){
2122
+ // foreach( $row as $kc => $cols ){
2123
+ // foreach( $cols as $kf => $field ){
2124
+ // if( $kf === 'body' && $field ){
2125
+ // if( $field['type'] === 'tinymce' ) $field['wp_editor_settings'] = WPF()->tpl->editor_buttons('post');
2126
+ // $field['type'] = WPF()->tpl->forms['threaded_reply_rich_editor'] ? 'tinymce' : 'textarea';
2127
+ // $field['textareaid'] = uniqid('wpf_post_body_');
2128
+ // $field['minLength'] = $this->options['post_body_min_length'];
2129
+ // $field['maxLength'] = $this->options['post_body_max_length'];
2130
+ // $fields[$kr][$kc][$kf] = $field;
2131
+ // }
2132
+ // }
2133
+ // }
2134
+ // }
2135
+ //
2136
+ // return $fields;
2137
+ // }
2138
+ //
2139
+ // public function get_reply_fields_list($only_defaults = false, $guest = false){
2140
+ // $fields_list = array('body');
2141
+ // $fields_structure = $this->get_reply_fields_structure($only_defaults, $guest);
2142
+ // foreach ( $fields_structure as $r ){
2143
+ // foreach ( $r as $c ){
2144
+ // foreach ($c as $f){
2145
+ // $fields_list[] = $f;
2146
+ // }
2147
+ // }
2148
+ // }
2149
+ // return array_values(array_unique($fields_list));
2150
+ // }
2151
+ // // -- END -- get threaded reply fields
2152
 
2153
  public function get_search_fields($values){
2154
  $values = (array) $values;
2155
  $values = wp_slash($values);
2156
 
2157
+ $topic_fields = WPF()->post->get_topic_fields_list(false, array(), !WPF()->current_userid);
2158
  $topic_fields = array_flip($topic_fields);
2159
  $fields = $this->get_fields();
2160
  $fields = array_intersect_key($fields, $topic_fields);
2175
  $content .= '<div class="wpf-topic-fields">';
2176
  $content .= apply_filters('wpforo_topic_fields_before', '', $post);
2177
  $forum = WPF()->forum->get_forum($post['forumid']);
2178
+ $fields = WPF()->post->get_topic_fields_list(false, $forum, !WPF()->current_userid);
2179
  foreach ( $fields as $field ){
2180
  if( $postmeta = wpfval($postmetas, $field) ){
2181
+ $field = WPF()->post->get_field($field, 'topic', $forum);
2182
  if( !(int) wpfval($field, 'isDefault') ){
2183
  $field['value'] = $postmeta;
2184
  $field = WPF()->form->prepare_values( WPF()->form->esc_field($field) );
wpf-includes/class-ramcache.php CHANGED
@@ -6,17 +6,17 @@ class wpForoRamCache {
6
  /**
7
  * @var array
8
  */
9
- private static $sql_cache;
10
 
11
  /**
12
- * wpForoSqlCache constructor.
13
  */
14
  public function __construct() {
15
  $this->reset();
16
  }
17
 
18
  /**
19
- * set empty array to static $sql_cache
20
  *
21
  * @param mixed $key
22
  *
@@ -24,9 +24,9 @@ class wpForoRamCache {
24
  */
25
  public function reset( $key = null ) {
26
  if( is_null($key) ){
27
- self::$sql_cache = array();
28
  }else{
29
- unset( self::$sql_cache[ $this->fix_key($key) ] );
30
  }
31
  }
32
 
@@ -41,38 +41,58 @@ class wpForoRamCache {
41
  }
42
 
43
  /**
44
- * checking if this sql query already cached
45
  *
46
- * @param mixed $key string SQL query
47
  *
48
  * @return bool
49
  */
50
  public function is_exist( $key ) {
51
- return array_key_exists( $this->fix_key($key), self::$sql_cache );
52
  }
53
 
54
  /**
55
- * return already cached SQL data
56
  *
57
- * @param mixed $key string sql query
58
  *
59
  * @return mixed
60
  */
61
  public function get( $key ) {
62
  if( $this->is_exist($key) ){
63
- return self::$sql_cache[ $this->fix_key($key) ];
64
  }else{
65
  return null;
66
  }
67
  }
68
 
69
  /**
70
- * storing a cache of provided SQL data
71
  *
72
- * @param mixed $key string sql query
73
  * @param mixed $data
74
  */
75
  public function set( $key, $data ) {
76
- self::$sql_cache[ $this->fix_key($key) ] = $data;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  }
78
  }
6
  /**
7
  * @var array
8
  */
9
+ private static $ram_cache;
10
 
11
  /**
12
+ * wpForoRamCache constructor.
13
  */
14
  public function __construct() {
15
  $this->reset();
16
  }
17
 
18
  /**
19
+ * set empty array to static $ram_cache
20
  *
21
  * @param mixed $key
22
  *
24
  */
25
  public function reset( $key = null ) {
26
  if( is_null($key) ){
27
+ self::$ram_cache = array();
28
  }else{
29
+ unset( self::$ram_cache[ $this->fix_key($key) ] );
30
  }
31
  }
32
 
41
  }
42
 
43
  /**
44
+ * checking if this data already cached
45
  *
46
+ * @param mixed $key unique key
47
  *
48
  * @return bool
49
  */
50
  public function is_exist( $key ) {
51
+ return array_key_exists( $this->fix_key($key), self::$ram_cache );
52
  }
53
 
54
  /**
55
+ * return already cached data
56
  *
57
+ * @param mixed $key unique key
58
  *
59
  * @return mixed
60
  */
61
  public function get( $key ) {
62
  if( $this->is_exist($key) ){
63
+ return self::$ram_cache[ $this->fix_key($key) ];
64
  }else{
65
  return null;
66
  }
67
  }
68
 
69
  /**
70
+ * storing a cache of provided data
71
  *
72
+ * @param mixed $key unique key
73
  * @param mixed $data
74
  */
75
  public function set( $key, $data ) {
76
+ self::$ram_cache[ $this->fix_key($key) ] = $data;
77
+ }
78
+
79
+ /**
80
+ * call callable function and return function returned value
81
+ * and store in static property for next call
82
+ *
83
+ * @param callable $func
84
+ * @param mixed ... $_, ... [optional] call_user_func parameters
85
+ *
86
+ * @return mixed
87
+ */
88
+ public function call_user_func( $func ){
89
+ if( !is_callable($func) ) return null;
90
+ $args = func_get_args();
91
+ array_shift($args);
92
+ $key = array($func, $args);
93
+ if( $this->is_exist($key) ) return $this->get($key);
94
+ $data = call_user_func_array($func, $args);
95
+ $this->set($key, $data);
96
+ return $data;
97
  }
98
  }
wpf-includes/class-revisions.php CHANGED
@@ -310,7 +310,7 @@ class wpForoRevision {
310
  'emails_include' => WPF()->current_user_email,
311
  'urls_include' => $this->get_current_url_query_vars_str()
312
  );
313
- $revisions_count = $this->get_count($args);
314
  }else{
315
  $revisions_count = null;
316
  }
310
  'emails_include' => WPF()->current_user_email,
311
  'urls_include' => $this->get_current_url_query_vars_str()
312
  );
313
+ $revisions_count = wpforo_ram_get( array($this, 'get_count'), $args );
314
  }else{
315
  $revisions_count = null;
316
  }
wpf-includes/class-subscribes.php CHANGED
@@ -117,9 +117,17 @@ class wpForoSubscribe{
117
  )
118
  ) ){
119
  if( isset($active) && $active == 1 ){
120
- WPF()->notice->add('You have been successfully subscribed', 'success');
 
 
 
 
121
  }else{
122
- WPF()->notice->add('Success! Thank you. Please check your email and click confirmation link below to complete this step.', 'success');
 
 
 
 
123
  }
124
  return $confirmkey;
125
  }
117
  )
118
  ) ){
119
  if( isset($active) && $active == 1 ){
120
+ if( intval($userid) === WPF()->current_userid ){
121
+ WPF()->notice->add('You have been successfully subscribed', 'success');
122
+ }else{
123
+ WPF()->notice->add('Success!', 'success');
124
+ }
125
  }else{
126
+ if( intval($userid) === WPF()->current_userid ) {
127
+ WPF()->notice->add( 'Success! Thank you. Please check your email and click confirmation link below to complete this step.', 'success' );
128
+ }else{
129
+ WPF()->notice->add( 'Success!', 'success' );
130
+ }
131
  }
132
  return $confirmkey;
133
  }
wpf-includes/class-template.php CHANGED
@@ -867,7 +867,7 @@ class wpForoTemplate{
867
  */
868
  function topic_form($forum = array(), $values = array()){
869
  if( !$forum ) $forum = WPF()->current_object['forum'];
870
- if( !is_array($forum) && is_scalar($forum) ) $forum = WPF()->forum->get_forum((int)$forum);
871
  if( !$forum ) return;
872
  $forumid = intval($forum['forumid']);
873
  $layout = WPF()->forum->get_layout($forum);
@@ -951,9 +951,10 @@ class wpForoTemplate{
951
  */
952
  function reply_form($topic = array(), $values = array()){
953
  if( !$topic ) $topic = WPF()->current_object['topic'];
954
- if( !is_array($topic) && is_scalar($topic) ) $topic = wpforo_topic($topic);
 
955
  if( wpfval($topic, 'closed') ) return;
956
- $layout = $topic['layout'] = WPF()->forum->get_layout($topic);
957
 
958
  $uniqid = uniqid();
959
  WPF()->data['varname'] = 'post';
@@ -975,11 +976,11 @@ class wpForoTemplate{
975
  <input type="hidden" class="wpf-form-topicid" name="post[topicid]" value="<?php echo intval($topic['topicid']) ?>">
976
  <input type="hidden" class="wpf-form-post-parentid" name="post[parentid]" value="<?php echo $parentid ?>">
977
  <input type="hidden" class="wpf-form-postid" name="post[postid]" value="<?php echo wpforo_bigintval(wpfval($values, 'postid')) ?>">
978
- <?php wpforo_fields( WPF()->post->get_post_fields($topic, $v, !WPF()->current_userid ) ); ?>
979
  <div class="wpf-extra-fields">
980
- <?php do_action('wpforo_reply_form_extra_before', $topic, $values) ?>
981
- <?php do_action('wpforo_reply_buttons_hook', $topic, $values); ?>
982
- <?php do_action('wpforo_reply_form_extra_after', $topic, $values) ?>
983
  </div>
984
  <?php if( !$values && wpforo_feature('subscribe_checkbox_on_post_editor') && WPF()->perm->forum_can('sb', $topic['forumid']) ) :
985
  $topic = array( "userid" => WPF()->current_userid , "itemid" => intval($topic['topicid']), "type" => "topic" );
@@ -993,7 +994,7 @@ class wpForoTemplate{
993
  </div>
994
  <?php endif;
995
  endif; ?>
996
- <?php do_action('wpforo_editor_post_submit_before', $topic, $values) ?>
997
  <div class="wpf-buttons-wrap">
998
  <?php if($values) : ?>
999
  <input type="button" class="wpf-button wpf-button-secondary wpf-edit-post-cancel" value="<?php wpforo_phrase('Cancel') ?>">
@@ -1002,7 +1003,7 @@ class wpForoTemplate{
1002
  <input type="submit" class="wpf-button" value="<?php $layout === 3 ? wpforo_phrase('Answer') : wpforo_phrase('Add Reply') ?>" title="Ctrl+Enter">
1003
  <?php endif ?>
1004
  </div>
1005
- <?php do_action('wpforo_editor_post_submit_after', $topic, $values) ?>
1006
  <div class="wpf-clear"></div>
1007
  </form>
1008
  </div>
867
  */
868
  function topic_form($forum = array(), $values = array()){
869
  if( !$forum ) $forum = WPF()->current_object['forum'];
870
+ if( is_scalar($forum) ) $forum = WPF()->forum->get_forum( (int)$forum );
871
  if( !$forum ) return;
872
  $forumid = intval($forum['forumid']);
873
  $layout = WPF()->forum->get_layout($forum);
951
  */
952
  function reply_form($topic = array(), $values = array()){
953
  if( !$topic ) $topic = WPF()->current_object['topic'];
954
+ if( is_scalar($topic) ) $topic = wpforo_topic($topic);
955
+ $forum = WPF()->forum->get_forum( wpfval($topic, 'forumid') );
956
  if( wpfval($topic, 'closed') ) return;
957
+ $layout = $topic['layout'] = WPF()->forum->get_layout($forum);
958
 
959
  $uniqid = uniqid();
960
  WPF()->data['varname'] = 'post';
976
  <input type="hidden" class="wpf-form-topicid" name="post[topicid]" value="<?php echo intval($topic['topicid']) ?>">
977
  <input type="hidden" class="wpf-form-post-parentid" name="post[parentid]" value="<?php echo $parentid ?>">
978
  <input type="hidden" class="wpf-form-postid" name="post[postid]" value="<?php echo wpforo_bigintval(wpfval($values, 'postid')) ?>">
979
+ <?php wpforo_fields( WPF()->post->get_post_fields($forum, $topic, $v, !WPF()->current_userid ) ); ?>
980
  <div class="wpf-extra-fields">
981
+ <?php do_action('wpforo_reply_form_extra_before', $topic, $values, $forum) ?>
982
+ <?php do_action('wpforo_reply_buttons_hook', $topic, $values, $forum); ?>
983
+ <?php do_action('wpforo_reply_form_extra_after', $topic, $values, $forum) ?>
984
  </div>
985
  <?php if( !$values && wpforo_feature('subscribe_checkbox_on_post_editor') && WPF()->perm->forum_can('sb', $topic['forumid']) ) :
986
  $topic = array( "userid" => WPF()->current_userid , "itemid" => intval($topic['topicid']), "type" => "topic" );
994
  </div>
995
  <?php endif;
996
  endif; ?>
997
+ <?php do_action('wpforo_editor_post_submit_before', $topic, $values, $forum) ?>
998
  <div class="wpf-buttons-wrap">
999
  <?php if($values) : ?>
1000
  <input type="button" class="wpf-button wpf-button-secondary wpf-edit-post-cancel" value="<?php wpforo_phrase('Cancel') ?>">
1003
  <input type="submit" class="wpf-button" value="<?php $layout === 3 ? wpforo_phrase('Answer') : wpforo_phrase('Add Reply') ?>" title="Ctrl+Enter">
1004
  <?php endif ?>
1005
  </div>
1006
+ <?php do_action('wpforo_editor_post_submit_after', $topic, $values, $forum) ?>
1007
  <div class="wpf-clear"></div>
1008
  </form>
1009
  </div>
wpf-includes/class-topics.php CHANGED
@@ -89,7 +89,6 @@ class wpForoTopic{
89
  extract($args, EXTR_OVERWRITE);
90
 
91
  if(isset($title)) $title = sanitize_text_field(trim($title));
92
- if(isset($slug)) $slug = sanitize_title($slug);
93
  if(isset($created)) $created = sanitize_text_field($created);
94
  if(isset($userid)) $userid = intval($userid);
95
  $type = ( isset($type) && $type ? 1 : 0 );
89
  extract($args, EXTR_OVERWRITE);
90
 
91
  if(isset($title)) $title = sanitize_text_field(trim($title));
 
92
  if(isset($created)) $created = sanitize_text_field($created);
93
  if(isset($userid)) $userid = intval($userid);
94
  $type = ( isset($type) && $type ? 1 : 0 );
wpf-includes/class-usergroups.php CHANGED
@@ -327,11 +327,19 @@ class wpForoUsergroup{
327
  }
328
 
329
  function get_visible_usergroup_ids(){
330
- return (array) WPF()->db->get_col("SELECT `groupid` FROM `".WPF()->tables->usergroups."` WHERE `visible` = 1");
 
 
 
 
331
  }
332
 
333
  function get_secondary_usergroup_ids(){
334
- return (array) WPF()->db->get_col("SELECT `groupid` FROM `".WPF()->tables->usergroups."` WHERE `groupid` NOT IN(1,2,4) AND `secondary` = 1");
 
 
 
 
335
  }
336
 
337
  function get_secondary_usergroup_names( $ids ){
327
  }
328
 
329
  function get_visible_usergroup_ids(){
330
+ $key = array('usergroup', 'get_visible_usergroup_ids');
331
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
332
+ $col = (array) WPF()->db->get_col("SELECT `groupid` FROM `".WPF()->tables->usergroups."` WHERE `visible` = 1");
333
+ WPF()->ram_cache->set($key, $col);
334
+ return $col;
335
  }
336
 
337
  function get_secondary_usergroup_ids(){
338
+ $key = array('usergroup', 'get_secondary_usergroup_ids');
339
+ if( WPF()->ram_cache->is_exist($key) ) return WPF()->ram_cache->get($key);
340
+ $col = (array) WPF()->db->get_col("SELECT `groupid` FROM `".WPF()->tables->usergroups."` WHERE `groupid` NOT IN(1,2,4) AND `secondary` = 1");
341
+ WPF()->ram_cache->set($key, $col);
342
+ return $col;
343
  }
344
 
345
  function get_secondary_usergroup_names( $ids ){
wpf-includes/functions-template.php CHANGED
@@ -1310,32 +1310,25 @@ function wpforo_topic( $topicid, $var = 'item', $echo = false ){
1310
  }
1311
 
1312
  function wpforo_forum( $forumid, $var = 'item', $echo = false ){
1313
- $data = array();
1314
- $forum = ( $var == 'item' ) ? array() : '';
1315
  $cache = WPF()->cache->on('object_cashe');
1316
  if( !$forumid ) return $forum;
1317
  if( $cache ) $forum = WPF()->cache->get_item( $forumid, 'forum' );
1318
 
1319
  if( empty($forum) ){
1320
  $forum = array();
1321
- if( !$cache && ($var == 'childs' || $var == 'counts') ){
1322
- if( $var == 'childs' ) {
1323
- WPF()->forum->get_childs($forumid, $data);
1324
- $forum['childs'] = $data;
1325
- }
1326
- else{
1327
- WPF()->forum->get_childs($forumid, $data);
1328
- $forum['childs'] = $data;
1329
- $forum['counts'] = WPF()->forum->get_counts( $data );
1330
- }
1331
  }
1332
  else{
1333
  $forum = WPF()->forum->get_forum($forumid);
1334
  if( !empty($forum) ){
1335
  if( $cache ){
1336
- WPF()->forum->get_childs($forum['forumid'], $data);
1337
- $forum['childs'] = $data;
1338
- $forum['counts'] = WPF()->forum->get_counts( $data );
1339
  }
1340
  if(!empty($forum)){
1341
  $cache_item = array( $forumid => $forum );
@@ -1781,22 +1774,27 @@ function wpforo_moderation_tools(){
1781
  <?php
1782
  }
1783
 
1784
- function wpforo_subscription_tools(){
1785
 
1786
- if ( !WPF()->current_object['user_is_same_current_user'] || ( wpforo_feature('subscribe_conf') && !wpforo_current_user_is('admin') && !WPF()->sbscrb->is_email_confirmed() ) ) return;
 
 
 
 
 
1787
  $sbs = array();
1788
  $allposts_checked = '';
1789
  $alltopics_checked = '';
1790
 
1791
- if( WPF()->sbscrb->get_subscribes(array('type' => 'forums-topics', 'userid' => WPF()->current_userid)) )
1792
  $allposts_checked = ' checked';
1793
- if( WPF()->sbscrb->get_subscribes(array('type' => 'forums', 'userid' => WPF()->current_userid)) )
1794
  $alltopics_checked = ' checked';
1795
 
1796
  if( !$allposts_checked && !$alltopics_checked ){
1797
- if( $sbs_forum = WPF()->sbscrb->get_subscribes(array('type' => 'forum', 'userid' => WPF()->current_userid)) )
1798
  foreach ($sbs_forum as $s) $sbs[$s['itemid']] = $s['type'];
1799
- if( $sbs_forum_topic = WPF()->sbscrb->get_subscribes(array('type' => 'forum-topic', 'userid' => WPF()->current_userid)) )
1800
  foreach ($sbs_forum_topic as $s) $sbs[$s['itemid']] = $s['type'];
1801
  }
1802
  ?>
@@ -1853,6 +1851,8 @@ function wpforo_subscription_tools(){
1853
  <p class="wpf-sbs-head"><?php wpforo_phrase('Subscription Manager') ?></p>
1854
  <form id="wpf_sbs_form" method="post" enctype="multipart/form-data" action="">
1855
  <input type="hidden" name="wpfaction" value="wpforo_subscribe_manager">
 
 
1856
  <div class="wpf-sbs-bulk">
1857
  <div class="wpf-sbs-bulk-posts"><input id="wpf_sbs_allposts" type="checkbox" name="wpforo[check_all]" value="forums-topics" <?php echo $allposts_checked ?>><label for="wpf_sbs_allposts"><?php wpforo_phrase('Subscribe to all new topics and posts') ?></label></div>
1858
  <div class="wpf-sbs-bulk-topics"><input id="wpf_sbs_alltopics" type="checkbox" name="wpforo[check_all]" value="forums" <?php echo $alltopics_checked ?>><label for="wpf_sbs_alltopics"><?php wpforo_phrase('Subscribe to all new topics') ?></label></div>
@@ -3087,4 +3087,83 @@ function wpforo_single_title( $type = 'post', $item = array(), $before = '', $af
3087
  if($title) $title = $before . $title . $after;
3088
  if($echo) echo $title;
3089
  return $title;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3090
  }
1310
  }
1311
 
1312
  function wpforo_forum( $forumid, $var = 'item', $echo = false ){
1313
+ $forum = ( $var === 'item' ) ? array() : '';
 
1314
  $cache = WPF()->cache->on('object_cashe');
1315
  if( !$forumid ) return $forum;
1316
  if( $cache ) $forum = WPF()->cache->get_item( $forumid, 'forum' );
1317
 
1318
  if( empty($forum) ){
1319
  $forum = array();
1320
+ if( !$cache && in_array($var, array('childs', 'counts'), true) ){
1321
+ $forum['childs'] = WPF()->forum->get_childs($forumid);
1322
+ $forum['childs'][] = $forumid;
1323
+ if( $var === 'counts' ) $forum['counts'] = WPF()->forum->get_counts( $forum['childs'] );
 
 
 
 
 
 
1324
  }
1325
  else{
1326
  $forum = WPF()->forum->get_forum($forumid);
1327
  if( !empty($forum) ){
1328
  if( $cache ){
1329
+ $forum['childs'] = WPF()->forum->get_childs($forum['forumid']);
1330
+ $forum['childs'][] = $forum['forumid'];
1331
+ $forum['counts'] = WPF()->forum->get_counts( $forum['childs'] );
1332
  }
1333
  if(!empty($forum)){
1334
  $cache_item = array( $forumid => $forum );
1774
  <?php
1775
  }
1776
 
1777
+ function wpforo_subscription_tools( $userid = 0 ){
1778
 
1779
+ if ( (!WPF()->current_object['user_is_same_current_user'] && !wpforo_current_user_is('admin')) || ( wpforo_feature('subscribe_conf') && !wpforo_current_user_is('admin') && !WPF()->sbscrb->is_email_confirmed() ) ) return;
1780
+ $userid = intval($userid);
1781
+ if( !$userid ){
1782
+ $userid = WPF()->current_object['userid'];
1783
+ if( !$userid ) $userid = WPF()->current_userid;
1784
+ }
1785
  $sbs = array();
1786
  $allposts_checked = '';
1787
  $alltopics_checked = '';
1788
 
1789
+ if( WPF()->sbscrb->get_subscribes(array('type' => 'forums-topics', 'userid' => $userid, 'active' => null)) )
1790
  $allposts_checked = ' checked';
1791
+ if( WPF()->sbscrb->get_subscribes(array('type' => 'forums', 'userid' => $userid, 'active' => null)) )
1792
  $alltopics_checked = ' checked';
1793
 
1794
  if( !$allposts_checked && !$alltopics_checked ){
1795
+ if( $sbs_forum = WPF()->sbscrb->get_subscribes(array('type' => 'forum', 'userid' => $userid, 'active' => null)) )
1796
  foreach ($sbs_forum as $s) $sbs[$s['itemid']] = $s['type'];
1797
+ if( $sbs_forum_topic = WPF()->sbscrb->get_subscribes(array('type' => 'forum-topic', 'userid' => $userid, 'active' => null)) )
1798
  foreach ($sbs_forum_topic as $s) $sbs[$s['itemid']] = $s['type'];
1799
  }
1800
  ?>
1851
  <p class="wpf-sbs-head"><?php wpforo_phrase('Subscription Manager') ?></p>
1852
  <form id="wpf_sbs_form" method="post" enctype="multipart/form-data" action="">
1853
  <input type="hidden" name="wpfaction" value="wpforo_subscribe_manager">
1854
+ <input type="hidden" name="wpforo[userid]" value="<?php echo $userid ?>">
1855
+ <?php wp_nonce_field( 'wpforo_verify_form', 'wpforo_form' ); ?>
1856
  <div class="wpf-sbs-bulk">
1857
  <div class="wpf-sbs-bulk-posts"><input id="wpf_sbs_allposts" type="checkbox" name="wpforo[check_all]" value="forums-topics" <?php echo $allposts_checked ?>><label for="wpf_sbs_allposts"><?php wpforo_phrase('Subscribe to all new topics and posts') ?></label></div>
1858
  <div class="wpf-sbs-bulk-topics"><input id="wpf_sbs_alltopics" type="checkbox" name="wpforo[check_all]" value="forums" <?php echo $alltopics_checked ?>><label for="wpf_sbs_alltopics"><?php wpforo_phrase('Subscribe to all new topics') ?></label></div>
3087
  if($title) $title = $before . $title . $after;
3088
  if($echo) echo $title;
3089
  return $title;
3090
+ }
3091
+
3092
+ function wpforo_schema($forum, $topic, $post, $type = '') {
3093
+
3094
+ $schema = '';
3095
+
3096
+ if( apply_filters("wpforo_schema", true) ){
3097
+
3098
+ if ( ! $type ) {
3099
+ if ( 3 === (int) wpfval( $forum, 'cat_layout' ) ) {
3100
+ $type = 'QAPage';
3101
+ }
3102
+ }
3103
+ if ( $type === 'QAPage' && wpfval( $topic, 'topicid' ) ){
3104
+ $extended = apply_filters("wpforo_schema_qa_extended_best_answer", true);
3105
+ $best_answer = WPF()->post->get_best_answer( $topic['topicid'], $extended );
3106
+ $suggested_answers_count = apply_filters("wpforo_schema_qa_suggested_answers_count", 3);
3107
+ $suggested_answers = WPF()->post->get_suggested_answers( $topic['topicid'], $suggested_answers_count );
3108
+ $schema .= '
3109
+ <script type="application/ld+json">
3110
+ {
3111
+ "@context": "https://schema.org",
3112
+ "@type": "QAPage",
3113
+ "mainEntity": {
3114
+ "@type": "Question",
3115
+ "name": "' . esc_attr( $post['title'] ) . '",
3116
+ "text": "' . esc_attr( sanitize_text_field( $post['body'] ) ) . '",
3117
+ "answerCount": ' . intval( $topic['answers'] ) . ',
3118
+ "upvoteCount": ' . intval( $post['votes'] ) . ',
3119
+ "dateCreated": "' . date( 'Y-m-d', strtotime( $post['created'] ) ) . 'T' . date( 'H:i', strtotime( $post['created'] ) ) . 'Z",
3120
+ "author": {
3121
+ "@type": "Person",
3122
+ "name": "' . wpforo_member( $post['created'], 'display_name' ) . '"
3123
+ }';
3124
+ if ( ! empty( $best_answer ) ) {
3125
+ $schema .= ',
3126
+ "acceptedAnswer": {
3127
+ "@type": "Answer",
3128
+ "text": "' . esc_attr( sanitize_text_field( $best_answer['body'] ) ) . '",
3129
+ "dateCreated": "' . date( 'Y-m-d', strtotime( $best_answer['created'] ) ) . 'T' . date( 'H:i', strtotime( $best_answer['created'] ) ) . 'Z",
3130
+ "upvoteCount": ' . intval( $best_answer['votes'] ) . ',
3131
+ "url": "' . wpforo_post( $best_answer['postid'], 'url' ) . '",
3132
+ "author": {
3133
+ "@type": "Person",
3134
+ "name": "' . wpforo_member( $best_answer['userid'], 'display_name' ) . '"
3135
+ }
3136
+ }';
3137
+ }
3138
+ if ( ! empty( $suggested_answers ) ) {
3139
+ $schema .= ',
3140
+ "suggestedAnswer": [';
3141
+ $answers = '';
3142
+ foreach ( $suggested_answers as $key => $suggested_answer ) {
3143
+ if( $best_answer['postid'] === $suggested_answer['postid'] ){
3144
+ continue;
3145
+ }
3146
+ $answers .= '
3147
+ {
3148
+ "@type": "Answer",
3149
+ "text": "' . esc_attr( sanitize_text_field( $suggested_answer['body'] ) ) . '",
3150
+ "dateCreated": "' . date( 'Y-m-d', strtotime( $suggested_answer['created'] ) ) . 'T' . date( 'H:i', strtotime( $suggested_answer['created'] ) ) . 'Z",
3151
+ "upvoteCount": ' . intval( $suggested_answer['votes'] ) . ',
3152
+ "url": "' . wpforo_post( $suggested_answer['postid'], 'url' ) . '",
3153
+ "author": {
3154
+ "@type": "Person",
3155
+ "name": "' . wpforo_member( $suggested_answer['userid'], 'display_name' ) . '"
3156
+ }
3157
+ },';
3158
+ }
3159
+ $schema .= trim($answers, ',') . '
3160
+ ]';
3161
+ }
3162
+ $schema .= '
3163
+ }
3164
+ }
3165
+ </script>';
3166
+ }
3167
+ }
3168
+ return $schema;
3169
  }
wpf-includes/functions.php CHANGED
@@ -415,7 +415,8 @@ function wpforo_text( $text, $length = 0, $echo = true, $strip_tags = true, $str
415
  if($strip_urls) $text = preg_replace('#(?:[^\'\"]|^)(https?://[^\s\'\"<>]+)(?:[^\'\"]|$)#isu', '', $text);
416
  if($strip_tags) $text = strip_tags($text);
417
  if($strip_shortcodes){
418
- $text = preg_replace('#\[attach[^\[\]]*\][^\[\]]*\[/attach\]#isu', '', $text);
 
419
  $text = strip_shortcodes( $text );
420
  }
421
  $text = apply_filters('wpforo_text', $text, $length, $echo, $strip_tags, $strip_urls, $strip_shortcodes, $strip_quotes);
@@ -487,7 +488,7 @@ function wpforo_content_filter( $content ){
487
  }
488
  $content = apply_filters('wpforo_body_text_filter', $content);
489
  if( apply_filters('wpforo_auto_embed_image', true) ) $content = preg_replace('#([^\'\"]|^)(https?://[^\s\'\"<>]+\.(?:jpg|jpeg|png|gif|ico|svg|bmp|tiff))([^\'\"]|$)#isu', '$1 <a class="wpforo-auto-embeded-link" href="$2" target="_blank"><img class="wpforo-auto-embeded-image" src="$2"/></a> $3', $content);
490
- if( apply_filters('wpforo_auto_embed_link', true ) ) $content = preg_replace('#([^\'\"]|^)(https?://[^\s\'\"<>]+)([^\'\"]|$)#isu', '$1 <a class="wpforo-auto-embeded-link" href="$2" target="_blank">$2</a> $3', $content);
491
  if(preg_match_all('#<pre([^<>]*)>(.*?class=[\'"]wpforo-auto-embeded[^\'"]*[\'"].*?)</pre>#isu', $content, $matches, PREG_SET_ORDER)){
492
  foreach($matches as $match){
493
  $match[2] = preg_replace('#<img[^<>]*class=[\'"]wpforo-auto-embeded-image[\'"][^<>]*src=[\'"]([^\'"]*)[\'"][^<>]*>#isu', '$1', $match[2]);
@@ -2471,4 +2472,14 @@ function wpforo_clean_folder( $directory ) {
2471
  */
2472
  function wpforo_fix_table_name($basename){
2473
  return WPF()->fix_table_name($basename);
 
 
 
 
 
 
 
 
 
 
2474
  }
415
  if($strip_urls) $text = preg_replace('#(?:[^\'\"]|^)(https?://[^\s\'\"<>]+)(?:[^\'\"]|$)#isu', '', $text);
416
  if($strip_tags) $text = strip_tags($text);
417
  if($strip_shortcodes){
418
+ $text = preg_replace('#\[attach[^\[\]]*\][^\[\]]*\[/attach\]#isu', '', $text);
419
+ $text = preg_replace('#\[spoiler[^\[\]]*\][^\[\]]*\[/spoiler\]#isu', '', $text);
420
  $text = strip_shortcodes( $text );
421
  }
422
  $text = apply_filters('wpforo_text', $text, $length, $echo, $strip_tags, $strip_urls, $strip_shortcodes, $strip_quotes);
488
  }
489
  $content = apply_filters('wpforo_body_text_filter', $content);
490
  if( apply_filters('wpforo_auto_embed_image', true) ) $content = preg_replace('#([^\'\"]|^)(https?://[^\s\'\"<>]+\.(?:jpg|jpeg|png|gif|ico|svg|bmp|tiff))([^\'\"]|$)#isu', '$1 <a class="wpforo-auto-embeded-link" href="$2" target="_blank"><img class="wpforo-auto-embeded-image" src="$2"/></a> $3', $content);
491
+ if( apply_filters('wpforo_auto_embed_link', true ) ) $content = preg_replace('#([^\'\"]|^)(https?://[^\s\'\"<>\[\]]+)([^\'\"]|$)#isu', '$1 <a class="wpforo-auto-embeded-link" href="$2" target="_blank">$2</a> $3', $content);
492
  if(preg_match_all('#<pre([^<>]*)>(.*?class=[\'"]wpforo-auto-embeded[^\'"]*[\'"].*?)</pre>#isu', $content, $matches, PREG_SET_ORDER)){
493
  foreach($matches as $match){
494
  $match[2] = preg_replace('#<img[^<>]*class=[\'"]wpforo-auto-embeded-image[\'"][^<>]*src=[\'"]([^\'"]*)[\'"][^<>]*>#isu', '$1', $match[2]);
2472
  */
2473
  function wpforo_fix_table_name($basename){
2474
  return WPF()->fix_table_name($basename);
2475
+ }
2476
+
2477
+ /**
2478
+ * @param callable $func
2479
+ * @param mixed ... $_, ... [optional] call_user_func parameters
2480
+ *
2481
+ * @return mixed
2482
+ */
2483
+ function wpforo_ram_get( $func ){
2484
+ return call_user_func_array( array(WPF()->ram_cache, 'call_user_func'), func_get_args() );
2485
  }
wpf-includes/wpf-hooks.php CHANGED
@@ -7,7 +7,7 @@ add_action( 'wpforo_actions', 'wpforo_do_uninstall');
7
  function wpforo_do_uninstall(){
8
  if( is_admin() && wpfval($_GET, 'action') === 'wpforo-uninstall' ){
9
  if( check_admin_referer( 'wpforo_uninstall' ) && current_user_can('administrator') ) wpforo_uninstall();
10
- wp_redirect( admin_url( 'plugins.php' ) );
11
  exit();
12
  }
13
  }
@@ -413,6 +413,7 @@ function wpforo_add_meta_tags(){
413
  $title = '';
414
  $og_img = '';
415
  $tw_img = '';
 
416
  $noindex = '';
417
  $template = '';
418
  $description = '';
@@ -462,6 +463,7 @@ function wpforo_add_meta_tags(){
462
  $image = wpforo_find_image_urls($content, true, 'og:image');
463
  if(isset($post['title'])) $title = wpforo_text($paged . $post['title'], 60, false);
464
  if(isset($post['body'])) $description = wpforo_text($paged . $post['body'], 150, false);
 
465
  }elseif( $template == 'profile' || $template == 'account' || $template == 'activity' || $template == 'subscriptions' ){
466
  if( isset(WPF()->general_options['title']) ) $title = $paged . WPF()->general_options['title'];
467
  $udata['name'] = (isset($user['display_name']) && $user['display_name']) ? wpforo_phrase( 'User', false ) . ': ' . $user['display_name'] : '';
@@ -492,7 +494,8 @@ function wpforo_add_meta_tags(){
492
  $tw_img = '<meta property="twitter:image" content="' . $image . '" />' . "\r\n";
493
  }
494
  $meta_tags = "\r\n<!-- wpForo SEO -->\r\n" . $noindex . "<link rel=\"canonical\" href=\"".$canonical."\" />\r\n<meta name=\"description\" content=\"" . esc_html($description) . "\" />\r\n<meta property=\"og:title\" content=\"" . esc_html($title) . "\" />\r\n<meta property=\"og:description\" content=\"" . esc_html($description) . "\" />\r\n<meta property=\"og:url\" content=\"" . $canonical . "\" />\r\n". $og_img . "<meta property=\"og:site_name\" content=\"" . get_bloginfo('name') . "\" />\r\n<meta property=\"og:type\" content=\"website\" />\r\n<meta name=\"twitter:description\" content=\"" . esc_html($description) . "\"/>\r\n<meta name=\"twitter:title\" content=\"" . esc_html($title) . "\" />\r\n<meta property=\"twitter:card\" content=\"summary_large_image\" />\r\n" . $tw_img . "<!-- wpForo SEO End -->\r\n\r\n";
495
- echo apply_filters('wpforo_seo_meta_tags', $meta_tags);
 
496
  }
497
  }
498
  }
@@ -1050,12 +1053,12 @@ function wpfl4_loadmore(){
1050
 
1051
  if( $forumid = intval($request['forumid']) ){
1052
  $items_count = 0;
1053
- $child_forums = array();
1054
- WPF()->forum->get_childs( $forumid, $child_forums );
1055
  $args = array(
1056
  'offset' => ( $request['paged'] - 1 ) * WPF()->forum->options['layout_threaded_intro_topics_count'],
1057
  'row_count' => WPF()->forum->options['layout_threaded_intro_topics_count'],
1058
- 'forumids' => $child_forums,
1059
  'orderby' => 'type, modified',
1060
  'order' => 'DESC'
1061
  );
@@ -1304,7 +1307,8 @@ function wpforo_frontend_register_scripts(){
1304
  'editor_settings' => WPF()->tpl->editor_buttons(),
1305
  'revision_options' => WPF()->revision->options,
1306
  'notice' => array(
1307
- 'login_or_register' => wpforo_get_login_or_register_notice_text()
 
1308
  )
1309
  )
1310
  );
@@ -2314,11 +2318,11 @@ function wpforo_redirect_to_custom_lostpassword() {
2314
 
2315
  if ( 'GET' == $_SERVER['REQUEST_METHOD'] ) {
2316
  if ( is_user_logged_in() ) {
2317
- wp_redirect( wpforo_home_url() );
2318
  exit;
2319
  }
2320
 
2321
- wp_redirect( wpforo_lostpass_url() );
2322
  exit;
2323
  }
2324
  }
@@ -2338,13 +2342,13 @@ function wpforo_redirect_to_custom_password_reset(){
2338
  } else {
2339
  WPF()->notice->add('The key is invalid', 'error');
2340
  }
2341
- wp_redirect( wpforo_login_url() );
2342
  exit;
2343
  }
2344
 
2345
  $redirect_url = wpforo_home_url( '?foro=resetpassword&rp_key='.esc_attr( urlencode($_REQUEST['key']) ).'&rp_login='.esc_attr( urlencode($_REQUEST['login']) ) );
2346
 
2347
- wp_redirect( $redirect_url );
2348
  exit;
2349
  }
2350
  }
@@ -2387,7 +2391,7 @@ function wpforo_do_password_reset() {
2387
  } else {
2388
  WPF()->notice->add('The key is invalid', 'error');
2389
  }
2390
- wp_redirect( wpforo_login_url() );
2391
  exit();
2392
  }
2393
 
@@ -2396,20 +2400,20 @@ function wpforo_do_password_reset() {
2396
  if ( $_POST['pass1'] != $_POST['pass2'] ) {
2397
  // Passwords don't match
2398
  WPF()->notice->add('The password reset mismatch', 'error');
2399
- wp_redirect( $redirect_url );
2400
  exit();
2401
  }
2402
 
2403
  if( strlen($_POST['pass1']) < WPF()->member->pass_min_length || strlen($_POST['pass1']) > WPF()->member->pass_max_length ){
2404
  WPF()->notice->add( 'Password length must be between %d characters and %d characters.', 'error', array(WPF()->member->pass_min_length, WPF()->member->pass_max_length) );
2405
- wp_redirect( $redirect_url );
2406
  exit();
2407
  }
2408
 
2409
  if ( empty( $_POST['pass1'] ) ) {
2410
  // Password is empty
2411
  WPF()->notice->add('The password reset empty', 'error');
2412
- wp_redirect( $redirect_url );
2413
  exit();
2414
  }
2415
 
@@ -2420,12 +2424,12 @@ function wpforo_do_password_reset() {
2420
  wp_signon($creds);
2421
 
2422
  WPF()->notice->add('The password has been changed', 'success');
2423
- wp_redirect( wpforo_login_url() );
2424
  exit();
2425
  }
2426
 
2427
  WPF()->notice->add('Invalid request.', 'error');
2428
- wp_redirect( wpforo_login_url() );
2429
  exit();
2430
 
2431
  }
7
  function wpforo_do_uninstall(){
8
  if( is_admin() && wpfval($_GET, 'action') === 'wpforo-uninstall' ){
9
  if( check_admin_referer( 'wpforo_uninstall' ) && current_user_can('administrator') ) wpforo_uninstall();
10
+ wp_safe_redirect( admin_url( 'plugins.php' ) );
11
  exit();
12
  }
13
  }
413
  $title = '';
414
  $og_img = '';
415
  $tw_img = '';
416
+ $schema = '';
417
  $noindex = '';
418
  $template = '';
419
  $description = '';
463
  $image = wpforo_find_image_urls($content, true, 'og:image');
464
  if(isset($post['title'])) $title = wpforo_text($paged . $post['title'], 60, false);
465
  if(isset($post['body'])) $description = wpforo_text($paged . $post['body'], 150, false);
466
+ if(isset($post['body'])) $schema = wpforo_schema($forum, $topic, $post);
467
  }elseif( $template == 'profile' || $template == 'account' || $template == 'activity' || $template == 'subscriptions' ){
468
  if( isset(WPF()->general_options['title']) ) $title = $paged . WPF()->general_options['title'];
469
  $udata['name'] = (isset($user['display_name']) && $user['display_name']) ? wpforo_phrase( 'User', false ) . ': ' . $user['display_name'] : '';
494
  $tw_img = '<meta property="twitter:image" content="' . $image . '" />' . "\r\n";
495
  }
496
  $meta_tags = "\r\n<!-- wpForo SEO -->\r\n" . $noindex . "<link rel=\"canonical\" href=\"".$canonical."\" />\r\n<meta name=\"description\" content=\"" . esc_html($description) . "\" />\r\n<meta property=\"og:title\" content=\"" . esc_html($title) . "\" />\r\n<meta property=\"og:description\" content=\"" . esc_html($description) . "\" />\r\n<meta property=\"og:url\" content=\"" . $canonical . "\" />\r\n". $og_img . "<meta property=\"og:site_name\" content=\"" . get_bloginfo('name') . "\" />\r\n<meta property=\"og:type\" content=\"website\" />\r\n<meta name=\"twitter:description\" content=\"" . esc_html($description) . "\"/>\r\n<meta name=\"twitter:title\" content=\"" . esc_html($title) . "\" />\r\n<meta property=\"twitter:card\" content=\"summary_large_image\" />\r\n" . $tw_img . "<!-- wpForo SEO End -->\r\n\r\n";
497
+ $schema = "<!-- wpForo Schema -->" . $schema . "\r\n<!-- wpForo Schema End -->\r\n\r\n";
498
+ echo apply_filters('wpforo_seo_meta_tags', $meta_tags . $schema);
499
  }
500
  }
501
  }
1053
 
1054
  if( $forumid = intval($request['forumid']) ){
1055
  $items_count = 0;
1056
+ $childs = WPF()->forum->get_childs( $forumid );
1057
+ $childs[] = $forumid;
1058
  $args = array(
1059
  'offset' => ( $request['paged'] - 1 ) * WPF()->forum->options['layout_threaded_intro_topics_count'],
1060
  'row_count' => WPF()->forum->options['layout_threaded_intro_topics_count'],
1061
+ 'forumids' => $childs,
1062
  'orderby' => 'type, modified',
1063
  'order' => 'DESC'
1064
  );
1307
  'editor_settings' => WPF()->tpl->editor_buttons(),
1308
  'revision_options' => WPF()->revision->options,
1309
  'notice' => array(
1310
+ 'login_or_register' => wpforo_get_login_or_register_notice_text(),
1311
+ 'timeouts' => WPF()->notice->get_timeouts()
1312
  )
1313
  )
1314
  );
2318
 
2319
  if ( 'GET' == $_SERVER['REQUEST_METHOD'] ) {
2320
  if ( is_user_logged_in() ) {
2321
+ wp_safe_redirect( wpforo_home_url() );
2322
  exit;
2323
  }
2324
 
2325
+ wp_safe_redirect( wpforo_lostpass_url() );
2326
  exit;
2327
  }
2328
  }
2342
  } else {
2343
  WPF()->notice->add('The key is invalid', 'error');
2344
  }
2345
+ wp_safe_redirect( wpforo_login_url() );
2346
  exit;
2347
  }
2348
 
2349
  $redirect_url = wpforo_home_url( '?foro=resetpassword&rp_key='.esc_attr( urlencode($_REQUEST['key']) ).'&rp_login='.esc_attr( urlencode($_REQUEST['login']) ) );
2350
 
2351
+ wp_safe_redirect( $redirect_url );
2352
  exit;
2353
  }
2354
  }
2391
  } else {
2392
  WPF()->notice->add('The key is invalid', 'error');
2393
  }
2394
+ wp_safe_redirect( wpforo_login_url() );
2395
  exit();
2396
  }
2397
 
2400
  if ( $_POST['pass1'] != $_POST['pass2'] ) {
2401
  // Passwords don't match
2402
  WPF()->notice->add('The password reset mismatch', 'error');
2403
+ wp_safe_redirect( $redirect_url );
2404
  exit();
2405
  }
2406
 
2407
  if( strlen($_POST['pass1']) < WPF()->member->pass_min_length || strlen($_POST['pass1']) > WPF()->member->pass_max_length ){
2408
  WPF()->notice->add( 'Password length must be between %d characters and %d characters.', 'error', array(WPF()->member->pass_min_length, WPF()->member->pass_max_length) );
2409
+ wp_safe_redirect( $redirect_url );
2410
  exit();
2411
  }
2412
 
2413
  if ( empty( $_POST['pass1'] ) ) {
2414
  // Password is empty
2415
  WPF()->notice->add('The password reset empty', 'error');
2416
+ wp_safe_redirect( $redirect_url );
2417
  exit();
2418
  }
2419
 
2424
  wp_signon($creds);
2425
 
2426
  WPF()->notice->add('The password has been changed', 'success');
2427
+ wp_safe_redirect( wpforo_login_url() );
2428
  exit();
2429
  }
2430
 
2431
  WPF()->notice->add('Invalid request.', 'error');
2432
+ wp_safe_redirect( wpforo_login_url() );
2433
  exit();
2434
 
2435
  }
wpf-languages/wpforo.pot CHANGED
@@ -5,7 +5,7 @@ msgid ""
5
  msgstr ""
6
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
7
  "Project-Id-Version: Forum - wpForo\n"
8
- "POT-Creation-Date: 2021-03-12 06:27+0300\n"
9
  "PO-Revision-Date: 2016-06-28 21:09+0400\n"
10
  "Last-Translator: \n"
11
  "Language-Team: \n"
@@ -73,49 +73,49 @@ msgstr ""
73
  #: wpf-admin/options.php:15 wpf-admin/tools-tabs/misc.php:94
74
  #: wpf-includes/integration/buddypress.php:11
75
  #: wpf-includes/integration/buddypress.php:57
76
- #: wpf-includes/integration/buddypress.php:129 wpf-includes/wpf-hooks.php:2683
77
  #: wpf-includes/wpf-phrases.php:309
78
  msgid "Forums"
79
  msgstr ""
80
 
81
  #: wpf-admin/admin.php:42 wpf-includes/wpf-hooks.php:22
82
- #: wpf-includes/wpf-hooks.php:2689
83
  msgid "Settings"
84
  msgstr ""
85
 
86
- #: wpf-admin/admin.php:45 wpf-includes/wpf-hooks.php:2693
87
  #: wpf-includes/wpf-phrases.php:916
88
  msgid "Tools"
89
  msgstr ""
90
 
91
- #: wpf-admin/admin.php:48 wpf-includes/wpf-hooks.php:2697
92
  msgid "Moderation"
93
  msgstr ""
94
 
95
  #: wpf-admin/admin.php:51 wpf-admin/dashboard.php:132 wpf-admin/member.php:10
96
  #: wpf-admin/options.php:18 wpf-admin/tools-tabs/misc.php:114
97
- #: wpf-admin/usergroup.php:36 wpf-includes/wpf-hooks.php:2701
98
  #: wpf-includes/wpf-phrases.php:364
99
  msgid "Members"
100
  msgstr ""
101
 
102
  #: wpf-admin/admin.php:54 wpf-admin/usergroup.php:11 wpf-admin/usergroup.php:155
103
- #: wpf-includes/wpf-hooks.php:2705
104
  msgid "Usergroups"
105
  msgstr ""
106
 
107
- #: wpf-admin/admin.php:57 wpf-includes/wpf-hooks.php:2711
108
  #: wpf-includes/wpf-phrases.php:791
109
  msgid "Phrases"
110
  msgstr ""
111
 
112
- #: wpf-admin/admin.php:60 wpf-includes/wpf-hooks.php:2717
113
  #: wpf-includes/wpf-phrases.php:792
114
  msgid "Themes"
115
  msgstr ""
116
 
117
  #: wpf-admin/admin.php:63 wpf-admin/options.php:24
118
- #: wpf-includes/wpf-hooks.php:2721 wpf-includes/wpf-phrases.php:211
119
  msgid "Addons"
120
  msgstr ""
121
 
@@ -190,13 +190,13 @@ msgid "Board Statistic"
190
  msgstr ""
191
 
192
  #: wpf-admin/dashboard.php:124 wpf-admin/options-tabs/posts.php:45
193
- #: wpf-admin/options-tabs/styles.php:23 wpf-includes/class-forums.php:780
194
  #: wpf-includes/wpf-phrases.php:524
195
  msgid "Topics"
196
  msgstr ""
197
 
198
  #: wpf-admin/dashboard.php:128 wpf-admin/options-tabs/posts.php:46
199
- #: wpf-includes/class-forums.php:780 wpf-includes/wpf-phrases.php:418
200
  msgid "Posts"
201
  msgstr ""
202
 
@@ -370,7 +370,7 @@ msgstr ""
370
  msgid "Other"
371
  msgstr ""
372
 
373
- #: wpf-admin/deactivation-dialog.php:142 wpf-includes/wpf-hooks.php:1423
374
  msgid "Please provide more information"
375
  msgstr ""
376
 
@@ -528,18 +528,18 @@ msgstr ""
528
  msgid "Are you sure you want to delete this forum?"
529
  msgstr ""
530
 
531
- #: wpf-admin/forum.php:221 wpf-admin/includes/member-listtable.php:91
532
- #: wpf-admin/includes/member-listtable.php:235
533
  #: wpf-admin/includes/moderation-listtable.php:92
534
  #: wpf-admin/includes/moderation-listtable.php:193 wpf-admin/themes.php:68
535
  #: wpf-admin/tools-tabs/antispam.php:313 wpf-admin/usergroup.php:75
536
- #: wpf-admin/usergroup.php:276 wpf-includes/wpf-hooks.php:1416
537
  #: wpf-includes/wpf-phrases.php:252
538
  msgid "Delete"
539
  msgstr ""
540
 
541
  #: wpf-admin/forum.php:222 wpf-admin/includes/moderation-listtable.php:83
542
- #: wpf-admin/usergroup.php:77 wpf-includes/class-forums.php:800
543
  #: wpf-includes/wpf-phrases.php:541
544
  msgid "View"
545
  msgstr ""
@@ -640,100 +640,100 @@ msgstr ""
640
  msgid "default"
641
  msgstr ""
642
 
643
- #: wpf-admin/includes/member-listtable.php:87
644
  msgid "Edit User"
645
  msgstr ""
646
 
647
- #: wpf-admin/includes/member-listtable.php:88
648
  msgid "Edit Profile"
649
  msgstr ""
650
 
651
- #: wpf-admin/includes/member-listtable.php:89
652
  msgid "Ban User"
653
  msgstr ""
654
 
655
- #: wpf-admin/includes/member-listtable.php:89
656
  msgid "Are you sure, you want to BAN this user?"
657
  msgstr ""
658
 
659
- #: wpf-admin/includes/member-listtable.php:89
660
- #: wpf-admin/includes/member-listtable.php:233
661
  msgid "Ban"
662
  msgstr ""
663
 
664
- #: wpf-admin/includes/member-listtable.php:90
665
  msgid "Unban User"
666
  msgstr ""
667
 
668
- #: wpf-admin/includes/member-listtable.php:90
669
  msgid "Are you sure, you want to UNBAN this user?"
670
  msgstr ""
671
 
672
- #: wpf-admin/includes/member-listtable.php:90
673
- #: wpf-admin/includes/member-listtable.php:234
674
  msgid "Unban"
675
  msgstr ""
676
 
677
- #: wpf-admin/includes/member-listtable.php:91
678
  msgid "Delete User"
679
  msgstr ""
680
 
681
- #: wpf-admin/includes/member-listtable.php:154
682
  #: wpf-admin/includes/moderation-listtable.php:136
683
  #: wpf-admin/includes/phrase-listtable.php:124 wpf-admin/usergroup.php:40
684
  msgid "ID"
685
  msgstr ""
686
 
687
- #: wpf-admin/includes/member-listtable.php:155 wpf-includes/wpf-phrases.php:257
688
  msgid "Display Name"
689
  msgstr ""
690
 
691
- #: wpf-admin/includes/member-listtable.php:156 wpf-includes/wpf-phrases.php:347
692
  msgid "Login"
693
  msgstr ""
694
 
695
- #: wpf-admin/includes/member-listtable.php:157 wpf-includes/wpf-phrases.php:261
696
  msgid "Email"
697
  msgstr ""
698
 
699
- #: wpf-admin/includes/member-listtable.php:158 wpf-includes/wpf-phrases.php:317
700
  msgid "Group"
701
  msgstr ""
702
 
703
- #: wpf-admin/includes/member-listtable.php:159 wpf-admin/usergroup.php:157
704
  #: wpf-includes/wpf-phrases.php:17
705
  msgid "Status"
706
  msgstr ""
707
 
708
- #: wpf-admin/includes/member-listtable.php:160
709
  msgid "Last Login"
710
  msgstr ""
711
 
712
- #: wpf-admin/includes/member-listtable.php:161 wpf-includes/wpf-phrases.php:831
713
  msgid "Forum Posts"
714
  msgstr ""
715
 
716
- #: wpf-admin/includes/member-listtable.php:162 wpf-includes/wpf-phrases.php:832
717
  msgid "Blog Posts"
718
  msgstr ""
719
 
720
- #: wpf-admin/includes/member-listtable.php:163 wpf-includes/wpf-phrases.php:833
721
  msgid "Blog Comments"
722
  msgstr ""
723
 
724
- #: wpf-admin/includes/member-listtable.php:258
725
  msgid "Change usergroup to…"
726
  msgstr ""
727
 
728
- #: wpf-admin/includes/member-listtable.php:261
729
  msgid "Change"
730
  msgstr ""
731
 
732
- #: wpf-admin/includes/member-listtable.php:370 wpf-includes/wpf-phrases.php:536
733
  msgid "filter by group"
734
  msgstr ""
735
 
736
- #: wpf-admin/includes/member-listtable.php:391
737
  msgid "filter by status"
738
  msgstr ""
739
 
@@ -897,7 +897,7 @@ msgstr ""
897
  msgid "Admin"
898
  msgstr ""
899
 
900
- #: wpf-admin/options-tabs/accesses.php:51 wpf-includes/class-forums.php:788
901
  #: wpf-includes/wpf-phrases.php:567
902
  msgid "edit"
903
  msgstr ""
@@ -908,7 +908,7 @@ msgid ""
908
  "this access will lost all forum permissions."
909
  msgstr ""
910
 
911
- #: wpf-admin/options-tabs/accesses.php:58 wpf-includes/class-forums.php:794
912
  #: wpf-includes/wpf-phrases.php:566
913
  msgid "delete"
914
  msgstr ""
@@ -1762,7 +1762,7 @@ msgid ""
1762
  msgstr ""
1763
 
1764
  #: wpf-admin/options-tabs/features.php:81 wpf-admin/usergroup.php:37
1765
- #: wpf-includes/wpf-hooks.php:1410
1766
  msgid "Default"
1767
  msgstr ""
1768
 
@@ -1856,7 +1856,7 @@ msgstr ""
1856
  msgid "one URL per line"
1857
  msgstr ""
1858
 
1859
- #: wpf-admin/options-tabs/general.php:48 wpf-includes/wpf-hooks.php:2671
1860
  msgid "Visit Forum"
1861
  msgstr ""
1862
 
@@ -2012,7 +2012,7 @@ msgstr ""
2012
  msgid "Member Custom Title by default"
2013
  msgstr ""
2014
 
2015
- #: wpf-admin/options-tabs/members.php:111 wpf-includes/wpf-hooks.php:1601
2016
  #: wpf-includes/wpf-phrases.php:433
2017
  msgid "Rating Level"
2018
  msgstr ""
@@ -2045,7 +2045,7 @@ msgstr ""
2045
  msgid "More"
2046
  msgstr ""
2047
 
2048
- #: wpf-admin/options-tabs/members.php:122 wpf-includes/wpf-hooks.php:1609
2049
  #: wpf-includes/wpf-phrases.php:344
2050
  msgid "Level"
2051
  msgstr ""
@@ -2571,7 +2571,7 @@ msgstr ""
2571
  msgid "Do not allow to attach files with following extensions:"
2572
  msgstr ""
2573
 
2574
- #: wpf-admin/tools-tabs/antispam.php:118 wpf-includes/wpf-hooks.php:2806
2575
  msgid "Google reCAPTCHA"
2576
  msgstr ""
2577
 
@@ -3509,35 +3509,35 @@ msgstr ""
3509
  msgid "Can be also used as Secondary Usergroup"
3510
  msgstr ""
3511
 
3512
- #: wpf-includes/class-actions.php:2125
3513
  msgid "Theme activate error"
3514
  msgstr ""
3515
 
3516
- #: wpf-includes/class-actions.php:2134
3517
  msgid "Theme activate success"
3518
  msgstr ""
3519
 
3520
- #: wpf-includes/class-actions.php:2157
3521
  msgid "Theme install error"
3522
  msgstr ""
3523
 
3524
- #: wpf-includes/class-actions.php:2166
3525
  msgid "Theme install success"
3526
  msgstr ""
3527
 
3528
- #: wpf-includes/class-actions.php:2189
3529
  msgid "Theme delete error"
3530
  msgstr ""
3531
 
3532
- #: wpf-includes/class-actions.php:2197
3533
  msgid "Theme delete success"
3534
  msgstr ""
3535
 
3536
- #: wpf-includes/class-actions.php:2220
3537
  msgid "Theme reset error"
3538
  msgstr ""
3539
 
3540
- #: wpf-includes/class-actions.php:2228
3541
  msgid "Theme reset success"
3542
  msgstr ""
3543
 
@@ -3710,11 +3710,11 @@ msgstr ""
3710
  msgid "Can view poll result"
3711
  msgstr ""
3712
 
3713
- #: wpf-includes/class-forums.php:783
3714
  msgid "Add a new Subforum"
3715
  msgstr ""
3716
 
3717
- #: wpf-includes/class-forums.php:783
3718
  msgid "Add a new Forum in this Category"
3719
  msgstr ""
3720
 
@@ -3752,19 +3752,19 @@ msgid ""
3752
  "another one."
3753
  msgstr ""
3754
 
3755
- #: wpf-includes/class-members.php:1980
3756
  msgid "What should be done with wpForo content owned by this user?"
3757
  msgstr ""
3758
 
3759
- #: wpf-includes/class-members.php:1982
3760
  msgid "What should be done with wpForo content owned by these users?"
3761
  msgstr ""
3762
 
3763
- #: wpf-includes/class-members.php:1986
3764
  msgid "Delete all wpForo content."
3765
  msgstr ""
3766
 
3767
- #: wpf-includes/class-members.php:1988
3768
  msgid "Attribute all content to:"
3769
  msgstr ""
3770
 
@@ -3774,19 +3774,19 @@ msgid ""
3774
  "Please moderate suspected files in Forums &gt; Tools &gt; Antispam Tab."
3775
  msgstr ""
3776
 
3777
- #: wpf-includes/class-notices.php:168 wpf-includes/wpf-phrases.php:255
3778
  msgid "Dismiss this notice."
3779
  msgstr ""
3780
 
3781
- #: wpf-includes/class-notices.php:209
3782
  msgid "New Addons for Your Forum!"
3783
  msgstr ""
3784
 
3785
- #: wpf-includes/class-notices.php:209
3786
  msgid "Extend your forum with wpForo addons"
3787
  msgstr ""
3788
 
3789
- #: wpf-includes/class-notices.php:222
3790
  msgid "View all Addons"
3791
  msgstr ""
3792
 
@@ -3944,7 +3944,7 @@ msgstr ""
3944
  msgid "Spoiler"
3945
  msgstr ""
3946
 
3947
- #: wpf-includes/class-template.php:2339 wpf-includes/wpf-phrases.php:513
3948
  msgid "Theme file not readable"
3949
  msgstr ""
3950
 
@@ -4264,22 +4264,22 @@ msgstr ""
4264
  msgid "Apply"
4265
  msgstr ""
4266
 
4267
- #: wpf-includes/functions.php:827
4268
  #, php-format
4269
  msgid "Could not write file %s"
4270
  msgstr ""
4271
 
4272
- #: wpf-includes/functions.php:2428
4273
  msgid "Action Required!"
4274
  msgstr ""
4275
 
4276
- #: wpf-includes/functions.php:2428
4277
  msgid ""
4278
  "Please update wpForo addons CSS style to make compatible with the current "
4279
  "version of wpForo."
4280
  msgstr ""
4281
 
4282
- #: wpf-includes/functions.php:2429
4283
  msgid "Update CSS >>"
4284
  msgstr ""
4285
 
@@ -4376,66 +4376,66 @@ msgstr ""
4376
  msgid "Uninstall"
4377
  msgstr ""
4378
 
4379
- #: wpf-includes/wpf-hooks.php:1410
4380
  msgid "Clear"
4381
  msgstr ""
4382
 
4383
- #: wpf-includes/wpf-hooks.php:1410
4384
  msgid "Select Color"
4385
  msgstr ""
4386
 
4387
- #: wpf-includes/wpf-hooks.php:1415 wpf-includes/wpf-phrases.php:183
4388
  msgid "Move"
4389
  msgstr ""
4390
 
4391
- #: wpf-includes/wpf-hooks.php:1422
4392
  msgid "Please choose one reasons before sending a feedback!"
4393
  msgstr ""
4394
 
4395
- #: wpf-includes/wpf-hooks.php:1424
4396
  msgid ""
4397
  "With the email address, please check the \"I agree to receive email\" checkbox "
4398
  "to proceed."
4399
  msgstr ""
4400
 
4401
- #: wpf-includes/wpf-hooks.php:1425
4402
  msgid "Please fill your email address for feedback"
4403
  msgstr ""
4404
 
4405
- #: wpf-includes/wpf-hooks.php:1426
4406
  msgid "Your email address is not valid"
4407
  msgstr ""
4408
 
4409
- #: wpf-includes/wpf-hooks.php:1484
4410
  msgid ""
4411
  "IMPORTANT: wpForo can't work with default permalink, please change permalink "
4412
  "structure"
4413
  msgstr ""
4414
 
4415
- #: wpf-includes/wpf-hooks.php:1520
4416
  msgid "Forum Profile Fields - wpForo"
4417
  msgstr ""
4418
 
4419
- #: wpf-includes/wpf-hooks.php:1528
4420
  msgid "Forum - Usergroup"
4421
  msgstr ""
4422
 
4423
- #: wpf-includes/wpf-hooks.php:1533
4424
  #, php-format
4425
  msgid ""
4426
  "Forum Usergroups are synched with User Roles based on the %s. When you change "
4427
  "this user Role the Usergroup is automatically changed according to that table."
4428
  msgstr ""
4429
 
4430
- #: wpf-includes/wpf-hooks.php:1540
4431
  msgid "Synced with user role"
4432
  msgstr ""
4433
 
4434
- #: wpf-includes/wpf-hooks.php:1544
4435
  msgid "Role-Usergroup Synchronization is Turned ON!"
4436
  msgstr ""
4437
 
4438
- #: wpf-includes/wpf-hooks.php:1545
4439
  msgid ""
4440
  "This user Usergroup is automatically changed according to current Role. If you "
4441
  "want to disable Role-Usergroup synchronization and manage Usergroups and User "
@@ -4443,19 +4443,19 @@ msgid ""
4443
  "admin page and disable \"Role-Usergroup Synchronization\" option."
4444
  msgstr ""
4445
 
4446
- #: wpf-includes/wpf-hooks.php:1556
4447
  msgid "Forum - Secondary Usergroups"
4448
  msgstr ""
4449
 
4450
- #: wpf-includes/wpf-hooks.php:1578
4451
  msgid "Forum - User Timezone"
4452
  msgstr ""
4453
 
4454
- #: wpf-includes/wpf-hooks.php:1589
4455
  msgid "User Reputation"
4456
  msgstr ""
4457
 
4458
- #: wpf-includes/wpf-hooks.php:1590
4459
  msgid ""
4460
  "By default all members get rating badges and titles based on number of posts. "
4461
  "However, using this option you can grant lower or higher rating to certain "
@@ -4463,59 +4463,59 @@ msgid ""
4463
  "be managed in Forums > Settings > Members Tab."
4464
  msgstr ""
4465
 
4466
- #: wpf-includes/wpf-hooks.php:1594
4467
  msgid "Default Rating"
4468
  msgstr ""
4469
 
4470
- #: wpf-includes/wpf-hooks.php:1595
4471
  msgid "Custom Rating"
4472
  msgstr ""
4473
 
4474
- #: wpf-includes/wpf-hooks.php:1602 wpf-includes/wpf-phrases.php:865
4475
  msgid "Rating Title"
4476
  msgstr ""
4477
 
4478
- #: wpf-includes/wpf-hooks.php:1603 wpf-includes/wpf-phrases.php:430
4479
  msgid "Rating Badge"
4480
  msgstr ""
4481
 
4482
- #: wpf-includes/wpf-hooks.php:2026 wpf-includes/wpf-hooks.php:2126
4483
  msgid "Please Moderate: "
4484
  msgstr ""
4485
 
4486
- #: wpf-includes/wpf-hooks.php:2027
4487
  msgid ""
4488
  "This topic is currently unapproved. You can approve topics in Dashboard "
4489
  "&raquo; Forums &raquo; Moderation admin page."
4490
  msgstr ""
4491
 
4492
- #: wpf-includes/wpf-hooks.php:2127
4493
  msgid ""
4494
  "This post is currently unapproved. You can approve posts in Dashboard &raquo; "
4495
  "Forums &raquo; Moderation admin page."
4496
  msgstr ""
4497
 
4498
- #: wpf-includes/wpf-hooks.php:2663 wpf-includes/wpf-hooks.php:2685
4499
  msgid "New Forum"
4500
  msgstr ""
4501
 
4502
- #: wpf-includes/wpf-hooks.php:2665
4503
  msgid "New User Group"
4504
  msgstr ""
4505
 
4506
- #: wpf-includes/wpf-hooks.php:2667 wpf-includes/wpf-hooks.php:2713
4507
  msgid "New Phrase"
4508
  msgstr ""
4509
 
4510
- #: wpf-includes/wpf-hooks.php:2679
4511
  msgid "Forum Dashboard"
4512
  msgstr ""
4513
 
4514
- #: wpf-includes/wpf-hooks.php:2707
4515
  msgid "New Usergroup"
4516
  msgstr ""
4517
 
4518
- #: wpf-includes/wpf-hooks.php:2805 wpf-includes/wpf-phrases.php:1086
4519
  #, php-format
4520
  msgid ""
4521
  "IMPORTANT! The forum registration form is probably under risk of spam attacks. "
@@ -4525,17 +4525,17 @@ msgid ""
4525
  "dismiss this message."
4526
  msgstr ""
4527
 
4528
- #: wpf-includes/wpf-hooks.php:2836
4529
  msgid "wpForo Polls addon is disabled!"
4530
  msgstr ""
4531
 
4532
- #: wpf-includes/wpf-hooks.php:2836
4533
  msgid ""
4534
  " Your addon version is not compatible with the current version of wpForo. "
4535
  "Please update the addon or downgrade wpForo to 1.7.7"
4536
  msgstr ""
4537
 
4538
- #: wpf-includes/wpf-hooks.php:2837
4539
  msgid "dismiss"
4540
  msgstr ""
4541
 
5
  msgstr ""
6
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
7
  "Project-Id-Version: Forum - wpForo\n"
8
+ "POT-Creation-Date: 2021-06-11 11:11+0400\n"
9
  "PO-Revision-Date: 2016-06-28 21:09+0400\n"
10
  "Last-Translator: \n"
11
  "Language-Team: \n"
73
  #: wpf-admin/options.php:15 wpf-admin/tools-tabs/misc.php:94
74
  #: wpf-includes/integration/buddypress.php:11
75
  #: wpf-includes/integration/buddypress.php:57
76
+ #: wpf-includes/integration/buddypress.php:129 wpf-includes/wpf-hooks.php:2687
77
  #: wpf-includes/wpf-phrases.php:309
78
  msgid "Forums"
79
  msgstr ""
80
 
81
  #: wpf-admin/admin.php:42 wpf-includes/wpf-hooks.php:22
82
+ #: wpf-includes/wpf-hooks.php:2693
83
  msgid "Settings"
84
  msgstr ""
85
 
86
+ #: wpf-admin/admin.php:45 wpf-includes/wpf-hooks.php:2697
87
  #: wpf-includes/wpf-phrases.php:916
88
  msgid "Tools"
89
  msgstr ""
90
 
91
+ #: wpf-admin/admin.php:48 wpf-includes/wpf-hooks.php:2701
92
  msgid "Moderation"
93
  msgstr ""
94
 
95
  #: wpf-admin/admin.php:51 wpf-admin/dashboard.php:132 wpf-admin/member.php:10
96
  #: wpf-admin/options.php:18 wpf-admin/tools-tabs/misc.php:114
97
+ #: wpf-admin/usergroup.php:36 wpf-includes/wpf-hooks.php:2705
98
  #: wpf-includes/wpf-phrases.php:364
99
  msgid "Members"
100
  msgstr ""
101
 
102
  #: wpf-admin/admin.php:54 wpf-admin/usergroup.php:11 wpf-admin/usergroup.php:155
103
+ #: wpf-includes/wpf-hooks.php:2709
104
  msgid "Usergroups"
105
  msgstr ""
106
 
107
+ #: wpf-admin/admin.php:57 wpf-includes/wpf-hooks.php:2715
108
  #: wpf-includes/wpf-phrases.php:791
109
  msgid "Phrases"
110
  msgstr ""
111
 
112
+ #: wpf-admin/admin.php:60 wpf-includes/wpf-hooks.php:2721
113
  #: wpf-includes/wpf-phrases.php:792
114
  msgid "Themes"
115
  msgstr ""
116
 
117
  #: wpf-admin/admin.php:63 wpf-admin/options.php:24
118
+ #: wpf-includes/wpf-hooks.php:2725 wpf-includes/wpf-phrases.php:211
119
  msgid "Addons"
120
  msgstr ""
121
 
190
  msgstr ""
191
 
192
  #: wpf-admin/dashboard.php:124 wpf-admin/options-tabs/posts.php:45
193
+ #: wpf-admin/options-tabs/styles.php:23 wpf-includes/class-forums.php:831
194
  #: wpf-includes/wpf-phrases.php:524
195
  msgid "Topics"
196
  msgstr ""
197
 
198
  #: wpf-admin/dashboard.php:128 wpf-admin/options-tabs/posts.php:46
199
+ #: wpf-includes/class-forums.php:831 wpf-includes/wpf-phrases.php:418
200
  msgid "Posts"
201
  msgstr ""
202
 
370
  msgid "Other"
371
  msgstr ""
372
 
373
+ #: wpf-admin/deactivation-dialog.php:142 wpf-includes/wpf-hooks.php:1427
374
  msgid "Please provide more information"
375
  msgstr ""
376
 
528
  msgid "Are you sure you want to delete this forum?"
529
  msgstr ""
530
 
531
+ #: wpf-admin/forum.php:221 wpf-admin/includes/member-listtable.php:93
532
+ #: wpf-admin/includes/member-listtable.php:237
533
  #: wpf-admin/includes/moderation-listtable.php:92
534
  #: wpf-admin/includes/moderation-listtable.php:193 wpf-admin/themes.php:68
535
  #: wpf-admin/tools-tabs/antispam.php:313 wpf-admin/usergroup.php:75
536
+ #: wpf-admin/usergroup.php:276 wpf-includes/wpf-hooks.php:1420
537
  #: wpf-includes/wpf-phrases.php:252
538
  msgid "Delete"
539
  msgstr ""
540
 
541
  #: wpf-admin/forum.php:222 wpf-admin/includes/moderation-listtable.php:83
542
+ #: wpf-admin/usergroup.php:77 wpf-includes/class-forums.php:851
543
  #: wpf-includes/wpf-phrases.php:541
544
  msgid "View"
545
  msgstr ""
640
  msgid "default"
641
  msgstr ""
642
 
643
+ #: wpf-admin/includes/member-listtable.php:89
644
  msgid "Edit User"
645
  msgstr ""
646
 
647
+ #: wpf-admin/includes/member-listtable.php:90
648
  msgid "Edit Profile"
649
  msgstr ""
650
 
651
+ #: wpf-admin/includes/member-listtable.php:91
652
  msgid "Ban User"
653
  msgstr ""
654
 
655
+ #: wpf-admin/includes/member-listtable.php:91
656
  msgid "Are you sure, you want to BAN this user?"
657
  msgstr ""
658
 
659
+ #: wpf-admin/includes/member-listtable.php:91
660
+ #: wpf-admin/includes/member-listtable.php:235
661
  msgid "Ban"
662
  msgstr ""
663
 
664
+ #: wpf-admin/includes/member-listtable.php:92
665
  msgid "Unban User"
666
  msgstr ""
667
 
668
+ #: wpf-admin/includes/member-listtable.php:92
669
  msgid "Are you sure, you want to UNBAN this user?"
670
  msgstr ""
671
 
672
+ #: wpf-admin/includes/member-listtable.php:92
673
+ #: wpf-admin/includes/member-listtable.php:236
674
  msgid "Unban"
675
  msgstr ""
676
 
677
+ #: wpf-admin/includes/member-listtable.php:93
678
  msgid "Delete User"
679
  msgstr ""
680
 
681
+ #: wpf-admin/includes/member-listtable.php:156
682
  #: wpf-admin/includes/moderation-listtable.php:136
683
  #: wpf-admin/includes/phrase-listtable.php:124 wpf-admin/usergroup.php:40
684
  msgid "ID"
685
  msgstr ""
686
 
687
+ #: wpf-admin/includes/member-listtable.php:157 wpf-includes/wpf-phrases.php:257
688
  msgid "Display Name"
689
  msgstr ""
690
 
691
+ #: wpf-admin/includes/member-listtable.php:158 wpf-includes/wpf-phrases.php:347
692
  msgid "Login"
693
  msgstr ""
694
 
695
+ #: wpf-admin/includes/member-listtable.php:159 wpf-includes/wpf-phrases.php:261
696
  msgid "Email"
697
  msgstr ""
698
 
699
+ #: wpf-admin/includes/member-listtable.php:160 wpf-includes/wpf-phrases.php:317
700
  msgid "Group"
701
  msgstr ""
702
 
703
+ #: wpf-admin/includes/member-listtable.php:161 wpf-admin/usergroup.php:157
704
  #: wpf-includes/wpf-phrases.php:17
705
  msgid "Status"
706
  msgstr ""
707
 
708
+ #: wpf-admin/includes/member-listtable.php:162
709
  msgid "Last Login"
710
  msgstr ""
711
 
712
+ #: wpf-admin/includes/member-listtable.php:163 wpf-includes/wpf-phrases.php:831
713
  msgid "Forum Posts"
714
  msgstr ""
715
 
716
+ #: wpf-admin/includes/member-listtable.php:164 wpf-includes/wpf-phrases.php:832
717
  msgid "Blog Posts"
718
  msgstr ""
719
 
720
+ #: wpf-admin/includes/member-listtable.php:165 wpf-includes/wpf-phrases.php:833
721
  msgid "Blog Comments"
722
  msgstr ""
723
 
724
+ #: wpf-admin/includes/member-listtable.php:260
725
  msgid "Change usergroup to…"
726
  msgstr ""
727
 
728
+ #: wpf-admin/includes/member-listtable.php:263
729
  msgid "Change"
730
  msgstr ""
731
 
732
+ #: wpf-admin/includes/member-listtable.php:372 wpf-includes/wpf-phrases.php:536
733
  msgid "filter by group"
734
  msgstr ""
735
 
736
+ #: wpf-admin/includes/member-listtable.php:393
737
  msgid "filter by status"
738
  msgstr ""
739
 
897
  msgid "Admin"
898
  msgstr ""
899
 
900
+ #: wpf-admin/options-tabs/accesses.php:51 wpf-includes/class-forums.php:839
901
  #: wpf-includes/wpf-phrases.php:567
902
  msgid "edit"
903
  msgstr ""
908
  "this access will lost all forum permissions."
909
  msgstr ""
910
 
911
+ #: wpf-admin/options-tabs/accesses.php:58 wpf-includes/class-forums.php:845
912
  #: wpf-includes/wpf-phrases.php:566
913
  msgid "delete"
914
  msgstr ""
1762
  msgstr ""
1763
 
1764
  #: wpf-admin/options-tabs/features.php:81 wpf-admin/usergroup.php:37
1765
+ #: wpf-includes/wpf-hooks.php:1414
1766
  msgid "Default"
1767
  msgstr ""
1768
 
1856
  msgid "one URL per line"
1857
  msgstr ""
1858
 
1859
+ #: wpf-admin/options-tabs/general.php:48 wpf-includes/wpf-hooks.php:2675
1860
  msgid "Visit Forum"
1861
  msgstr ""
1862
 
2012
  msgid "Member Custom Title by default"
2013
  msgstr ""
2014
 
2015
+ #: wpf-admin/options-tabs/members.php:111 wpf-includes/wpf-hooks.php:1605
2016
  #: wpf-includes/wpf-phrases.php:433
2017
  msgid "Rating Level"
2018
  msgstr ""
2045
  msgid "More"
2046
  msgstr ""
2047
 
2048
+ #: wpf-admin/options-tabs/members.php:122 wpf-includes/wpf-hooks.php:1613
2049
  #: wpf-includes/wpf-phrases.php:344
2050
  msgid "Level"
2051
  msgstr ""
2571
  msgid "Do not allow to attach files with following extensions:"
2572
  msgstr ""
2573
 
2574
+ #: wpf-admin/tools-tabs/antispam.php:118 wpf-includes/wpf-hooks.php:2810
2575
  msgid "Google reCAPTCHA"
2576
  msgstr ""
2577
 
3509
  msgid "Can be also used as Secondary Usergroup"
3510
  msgstr ""
3511
 
3512
+ #: wpf-includes/class-actions.php:2126
3513
  msgid "Theme activate error"
3514
  msgstr ""
3515
 
3516
+ #: wpf-includes/class-actions.php:2135
3517
  msgid "Theme activate success"
3518
  msgstr ""
3519
 
3520
+ #: wpf-includes/class-actions.php:2158
3521
  msgid "Theme install error"
3522
  msgstr ""
3523
 
3524
+ #: wpf-includes/class-actions.php:2167
3525
  msgid "Theme install success"
3526
  msgstr ""
3527
 
3528
+ #: wpf-includes/class-actions.php:2190
3529
  msgid "Theme delete error"
3530
  msgstr ""
3531
 
3532
+ #: wpf-includes/class-actions.php:2198
3533
  msgid "Theme delete success"
3534
  msgstr ""
3535
 
3536
+ #: wpf-includes/class-actions.php:2221
3537
  msgid "Theme reset error"
3538
  msgstr ""
3539
 
3540
+ #: wpf-includes/class-actions.php:2229
3541
  msgid "Theme reset success"
3542
  msgstr ""
3543
 
3710
  msgid "Can view poll result"
3711
  msgstr ""
3712
 
3713
+ #: wpf-includes/class-forums.php:834
3714
  msgid "Add a new Subforum"
3715
  msgstr ""
3716
 
3717
+ #: wpf-includes/class-forums.php:834
3718
  msgid "Add a new Forum in this Category"
3719
  msgstr ""
3720
 
3752
  "another one."
3753
  msgstr ""
3754
 
3755
+ #: wpf-includes/class-members.php:2069
3756
  msgid "What should be done with wpForo content owned by this user?"
3757
  msgstr ""
3758
 
3759
+ #: wpf-includes/class-members.php:2071
3760
  msgid "What should be done with wpForo content owned by these users?"
3761
  msgstr ""
3762
 
3763
+ #: wpf-includes/class-members.php:2075
3764
  msgid "Delete all wpForo content."
3765
  msgstr ""
3766
 
3767
+ #: wpf-includes/class-members.php:2077
3768
  msgid "Attribute all content to:"
3769
  msgstr ""
3770
 
3774
  "Please moderate suspected files in Forums &gt; Tools &gt; Antispam Tab."
3775
  msgstr ""
3776
 
3777
+ #: wpf-includes/class-notices.php:192 wpf-includes/wpf-phrases.php:255
3778
  msgid "Dismiss this notice."
3779
  msgstr ""
3780
 
3781
+ #: wpf-includes/class-notices.php:233
3782
  msgid "New Addons for Your Forum!"
3783
  msgstr ""
3784
 
3785
+ #: wpf-includes/class-notices.php:233
3786
  msgid "Extend your forum with wpForo addons"
3787
  msgstr ""
3788
 
3789
+ #: wpf-includes/class-notices.php:246
3790
  msgid "View all Addons"
3791
  msgstr ""
3792
 
3944
  msgid "Spoiler"
3945
  msgstr ""
3946
 
3947
+ #: wpf-includes/class-template.php:2340 wpf-includes/wpf-phrases.php:513
3948
  msgid "Theme file not readable"
3949
  msgstr ""
3950
 
4264
  msgid "Apply"
4265
  msgstr ""
4266
 
4267
+ #: wpf-includes/functions.php:828
4268
  #, php-format
4269
  msgid "Could not write file %s"
4270
  msgstr ""
4271
 
4272
+ #: wpf-includes/functions.php:2429
4273
  msgid "Action Required!"
4274
  msgstr ""
4275
 
4276
+ #: wpf-includes/functions.php:2429
4277
  msgid ""
4278
  "Please update wpForo addons CSS style to make compatible with the current "
4279
  "version of wpForo."
4280
  msgstr ""
4281
 
4282
+ #: wpf-includes/functions.php:2430
4283
  msgid "Update CSS >>"
4284
  msgstr ""
4285
 
4376
  msgid "Uninstall"
4377
  msgstr ""
4378
 
4379
+ #: wpf-includes/wpf-hooks.php:1414
4380
  msgid "Clear"
4381
  msgstr ""
4382
 
4383
+ #: wpf-includes/wpf-hooks.php:1414
4384
  msgid "Select Color"
4385
  msgstr ""
4386
 
4387
+ #: wpf-includes/wpf-hooks.php:1419 wpf-includes/wpf-phrases.php:183
4388
  msgid "Move"
4389
  msgstr ""
4390
 
4391
+ #: wpf-includes/wpf-hooks.php:1426
4392
  msgid "Please choose one reasons before sending a feedback!"
4393
  msgstr ""
4394
 
4395
+ #: wpf-includes/wpf-hooks.php:1428
4396
  msgid ""
4397
  "With the email address, please check the \"I agree to receive email\" checkbox "
4398
  "to proceed."
4399
  msgstr ""
4400
 
4401
+ #: wpf-includes/wpf-hooks.php:1429
4402
  msgid "Please fill your email address for feedback"
4403
  msgstr ""
4404
 
4405
+ #: wpf-includes/wpf-hooks.php:1430
4406
  msgid "Your email address is not valid"
4407
  msgstr ""
4408
 
4409
+ #: wpf-includes/wpf-hooks.php:1488
4410
  msgid ""
4411
  "IMPORTANT: wpForo can't work with default permalink, please change permalink "
4412
  "structure"
4413
  msgstr ""
4414
 
4415
+ #: wpf-includes/wpf-hooks.php:1524
4416
  msgid "Forum Profile Fields - wpForo"
4417
  msgstr ""
4418
 
4419
+ #: wpf-includes/wpf-hooks.php:1532
4420
  msgid "Forum - Usergroup"
4421
  msgstr ""
4422
 
4423
+ #: wpf-includes/wpf-hooks.php:1537
4424
  #, php-format
4425
  msgid ""
4426
  "Forum Usergroups are synched with User Roles based on the %s. When you change "
4427
  "this user Role the Usergroup is automatically changed according to that table."
4428
  msgstr ""
4429
 
4430
+ #: wpf-includes/wpf-hooks.php:1544
4431
  msgid "Synced with user role"
4432
  msgstr ""
4433
 
4434
+ #: wpf-includes/wpf-hooks.php:1548
4435
  msgid "Role-Usergroup Synchronization is Turned ON!"
4436
  msgstr ""
4437
 
4438
+ #: wpf-includes/wpf-hooks.php:1549
4439
  msgid ""
4440
  "This user Usergroup is automatically changed according to current Role. If you "
4441
  "want to disable Role-Usergroup synchronization and manage Usergroups and User "
4443
  "admin page and disable \"Role-Usergroup Synchronization\" option."
4444
  msgstr ""
4445
 
4446
+ #: wpf-includes/wpf-hooks.php:1560
4447
  msgid "Forum - Secondary Usergroups"
4448
  msgstr ""
4449
 
4450
+ #: wpf-includes/wpf-hooks.php:1582
4451
  msgid "Forum - User Timezone"
4452
  msgstr ""
4453
 
4454
+ #: wpf-includes/wpf-hooks.php:1593
4455
  msgid "User Reputation"
4456
  msgstr ""
4457
 
4458
+ #: wpf-includes/wpf-hooks.php:1594
4459
  msgid ""
4460
  "By default all members get rating badges and titles based on number of posts. "
4461
  "However, using this option you can grant lower or higher rating to certain "
4463
  "be managed in Forums > Settings > Members Tab."
4464
  msgstr ""
4465
 
4466
+ #: wpf-includes/wpf-hooks.php:1598
4467
  msgid "Default Rating"
4468
  msgstr ""
4469
 
4470
+ #: wpf-includes/wpf-hooks.php:1599
4471
  msgid "Custom Rating"
4472
  msgstr ""
4473
 
4474
+ #: wpf-includes/wpf-hooks.php:1606 wpf-includes/wpf-phrases.php:865
4475
  msgid "Rating Title"
4476
  msgstr ""
4477
 
4478
+ #: wpf-includes/wpf-hooks.php:1607 wpf-includes/wpf-phrases.php:430
4479
  msgid "Rating Badge"
4480
  msgstr ""
4481
 
4482
+ #: wpf-includes/wpf-hooks.php:2030 wpf-includes/wpf-hooks.php:2130
4483
  msgid "Please Moderate: "
4484
  msgstr ""
4485
 
4486
+ #: wpf-includes/wpf-hooks.php:2031
4487
  msgid ""
4488
  "This topic is currently unapproved. You can approve topics in Dashboard "
4489
  "&raquo; Forums &raquo; Moderation admin page."
4490
  msgstr ""
4491
 
4492
+ #: wpf-includes/wpf-hooks.php:2131
4493
  msgid ""
4494
  "This post is currently unapproved. You can approve posts in Dashboard &raquo; "
4495
  "Forums &raquo; Moderation admin page."
4496
  msgstr ""
4497
 
4498
+ #: wpf-includes/wpf-hooks.php:2667 wpf-includes/wpf-hooks.php:2689
4499
  msgid "New Forum"
4500
  msgstr ""
4501
 
4502
+ #: wpf-includes/wpf-hooks.php:2669
4503
  msgid "New User Group"
4504
  msgstr ""
4505
 
4506
+ #: wpf-includes/wpf-hooks.php:2671 wpf-includes/wpf-hooks.php:2717
4507
  msgid "New Phrase"
4508
  msgstr ""
4509
 
4510
+ #: wpf-includes/wpf-hooks.php:2683
4511
  msgid "Forum Dashboard"
4512
  msgstr ""
4513
 
4514
+ #: wpf-includes/wpf-hooks.php:2711
4515
  msgid "New Usergroup"
4516
  msgstr ""
4517
 
4518
+ #: wpf-includes/wpf-hooks.php:2809 wpf-includes/wpf-phrases.php:1086
4519
  #, php-format
4520
  msgid ""
4521
  "IMPORTANT! The forum registration form is probably under risk of spam attacks. "
4525
  "dismiss this message."
4526
  msgstr ""
4527
 
4528
+ #: wpf-includes/wpf-hooks.php:2840
4529
  msgid "wpForo Polls addon is disabled!"
4530
  msgstr ""
4531
 
4532
+ #: wpf-includes/wpf-hooks.php:2840
4533
  msgid ""
4534
  " Your addon version is not compatible with the current version of wpForo. "
4535
  "Please update the addon or downgrade wpForo to 1.7.7"
4536
  msgstr ""
4537
 
4538
+ #: wpf-includes/wpf-hooks.php:2841
4539
  msgid "dismiss"
4540
  msgstr ""
4541
 
wpf-themes/classic/colors.css CHANGED
@@ -730,43 +730,19 @@ body.wpf-dark #wpf-msg-box a:hover, body.wpf-dark #wpf-msg-box a:active{color:#6
730
  font-size: 13px; width: 100%; padding:10px 0; margin:0px;
731
  }
732
 
733
- #wpforo #wpforo-wrap #wpf-pm-load-more{color: #0099cc;}
734
- #wpforo #wpforo-wrap .wpforo-messages-content .whr{ border-top: 1px solid #e6e6e6 !important; color: #cccccc; }
735
- #wpforo #wpforo-wrap .wpforo-messages-content .whr abbr{ background-color: #ffffff; }
736
- #wpforo #wpforo-wrap .wpfpm-msg-inner{border-color: #e6e6e6; background-color: #e6e6e6; color:#555555}
737
- #wpforo #wpforo-wrap .wpfpm-msg-before:before{border-top-color: #e6e6e6;}
738
- #wpforo #wpforo-wrap .wpfpm-me .wpfpm-msg-inner{ background-color: #f5f5f5; border-color: #f5f5f5; color: #555555; }
739
- #wpforo #wpforo-wrap .wpfpm-me .wpfpm-msg-before:before{border-top-color: #f5f5f5;}
740
- #wpforo #wpforo-wrap .wpforo-messages-content .wpfpm-left{border-color: #e6e6e6 }
741
- #wpforo #wpforo-wrap .wpforo-messages-content .wpfpm-main{background-color: #ffffff;}
742
- #wpforo #wpforo-wrap .wpforo-messages-content .wpfpm-main .wpfpm-form-wrapper{ border-top: #43a6df 1px dotted;}
743
- #wpforo #wpforo-wrap .wpfpm-uli{ background-color: #f5f5f5; border-top-color: #e6e6e6; border-bottom-color: #ffffff;}
744
- #wpforo #wpforo-wrap .wpfpm-uli-active, #wpforo #wpforo-wrap .wpfpm-uli:hover{background-color: #43a6df;}
745
- #wpforo #wpforo-wrap .wpfpm-uli-active a, .wpfpm-uli:hover a, .wpfpm-uli a:hover{color: #ffffff !important;}
746
- #wpforo #wpforo-wrap .wpfpm-content{ background-color: #ffffff !important; }
747
- #wpforo #wpforo-wrap .wpforo-messages-content *::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); }
748
- #wpforo #wpforo-wrap .wpforo-messages-content *::-webkit-scrollbar-thumb { background: #555555; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }
749
- #wpforo #wpforo-wrap .wpforo-messages-content *::-webkit-scrollbar-thumb:window-inactive { background: #555555; }
750
- #wpforo #wpforo-wrap .wpforo-profile-wrap .wpfpm-toolbar{ background-color: #f5f5f5; color: #555555; }
751
- #wpforo #wpforo-wrap .wpforo-profile-wrap .wpfpm-toolbar #wpfpm-tools li a{ color: #555555; }
752
- #wpforo #wpforo-wrap .wpforo-profile-wrap #wpfpm-ul-users-tooltip-wrap:hover,
753
- #wpforo #wpforo-wrap .wpforo-profile-wrap #wpfpm_left_toggle_button:hover,
754
- #wpforo #wpforo-wrap .wpforo-profile-wrap .wpfpm-toolbar #wpfpm-tools li:hover a,
755
- #wpforo #wpforo-wrap .wpforo-profile-wrap .wpfpm-toolbar #wpfpm-tools li:hover,
756
- #wpforo #wpforo-wrap .wpfpm-add-user:hover, #wpforo #wpforo-wrap .wpfpm-add-user .wpfpm-add-user-go{ color: #43a6df; }
757
- #wpforo #wpforo-wrap .wpfpm-uli-cog-tooltip li:hover{ background-color: #0099cc; color: white; }
758
- #wpforo #wpforo-wrap #wpfpm-uli-users-wrap .wpfpm-ul-users-tooltip li:hover{ background-color: #0099cc; color: white; }
759
- #wpforo #wpforo-wrap #wpfpm-users-datalist > li.wpfpm-datalist-user:hover, #wpforo #wpforo-wrap #wpfpm-users-datalist > li.wpfpm-datalist-user:focus{ background-color: #0099cc; color: white; }
760
- #wpforo #wpforo-wrap .wpfpm-uli-avatar .wpfpm-add{ border-color: #43a6df; background: #ffffff; color: #43a6df; }
761
- #wpforo #wpforo-wrap .wpfpm-uli-has-message{border-bottom: 2px solid #ff812d !important;}
762
- #wpforo #wpforo-wrap .wpfpm-uli-unread-count{background-color: #ff812d; color: #ffffff;}
763
- #wpforo #wpforo-wrap .wpfpm_avatar_ban{color:#ff812d;}
764
- #wpforo #wpforo-wrap .wpfpm-form-blocked{border-bottom: 1px solid #ff812d;color: #ff812d;}
765
- #wpforo #wpforo-wrap .wpforo-messages-content{border:#e6e6e6 1px solid;}
766
- #wpforo #wpforo-wrap.wpf-dark .wpforo-profile-wrap .wpfpm-toolbar, #wpforo #wpforo-wrap.wpf-dark #wpfpm_left_toggle_button{color:#dadada;}
767
- #wpforo #wpforo-wrap.wpf-dark .wpfpm-msg-inner, #wpforo #wpforo-wrap.wpf-dark .wpfpm-msg-inner p{color:#dadada;}
768
- #wpforo #wpforo-wrap.wpf-dark .wpf-post-create{border:none;}
769
- #wpforo #wpforo-wrap.wpf-dark .wpfpm-uli-avatar .wpfpm-add{background:#dadada;}
770
- #wpforo #wpforo-wrap.wpf-dark .wpfpm-uli-details{color:#dadada;}
771
- #wpforo #wpforo-wrap.wpf-dark .wpforo-messages-content *::-webkit-scrollbar-thumb,
772
- #wpforo #wpforo-wrap.wpf-dark .wpforo-messages-content *::-webkit-scrollbar-thumb:window-inactive { background: #0099cc; }
730
  font-size: 13px; width: 100%; padding:10px 0; margin:0px;
731
  }
732
 
733
+ #wpforo #wpfa_dialog_wrap #wpfa_dialog{background-color: #ffffff; border-color: #e6e6e6;}
734
+ .wpf-dark #wpforo #wpfa_dialog_wrap #wpfa_dialog{background-color: #2f2c2c;}
735
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-error .fa,
736
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-error .fas,
737
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-error .fab,
738
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-error .far,
739
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-error .fal,
740
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-error,
741
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-item-col-error{ color: #f46464; }
742
+ #wpforo #wpfa_dialog .wpfa-button{ background-color: #43a6df; border-color: #0099cc; }
743
+ #wpforo #wpfa_dialog .wpfa-button.wpfa-button-add-to-post, #wpforo #wpfa_dialog .wpfa-button.wpfa-button-attach{ background-color: #86ba4c; border-color: #6fa634; }
744
+ #wpforo #wpfa_dialog .wpfa-button.wpfa-button-cancel{ background-color: #777777; border-color: #999999; }
745
+ #wpforo #wpfa_dialog .wpfa-button.wpfa-button-delete{ background-color: #ff7575; border-color: #f46464; }
746
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-dialog-item-row{border-color: #e6e6e6;}
747
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-dialog-item-row:nth-child(odd) { background-color: #f5f5f5; }
748
+ #wpforo #wpfa_dialog #wpfa_dialog_items .wpfa-dialog-item-row:hover{background-color: #dff4ff;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpf-themes/classic/layouts/4/forum-sub.php CHANGED
@@ -15,16 +15,16 @@
15
 
16
  <?php
17
  $items_count = 0;
18
- $child_forums = array();
19
- WPF()->forum->get_childs( $cat['forumid'], $child_forums );
20
- $args = array( 'row_count' => WPF()->forum->options['layout_threaded_intro_topics_count'], 'forumids' => $child_forums, 'orderby' => 'type, modified', 'order' => 'DESC' );
21
  $topics = WPF()->topic->get_topics( $args, $items_count );
22
  $load_more = $items_count >= WPF()->forum->options['layout_threaded_intro_topics_count'];
23
  if( !WPF()->forum->options['layout_threaded_display_subforums'] ){
24
  $args = array('parentid' => $cat['forumid']);
25
- $child_forums = WPF()->forum->get_child_forums($cat['forumid']);
26
  }
27
- $child_forums = apply_filters('wpforo_sub_forum_list_threaded_layout', $child_forums);
28
  ?>
29
 
30
  <div id="wpf-cat-<?php echo $cat['forumid'] ?>" class="wpfl-4">
@@ -34,10 +34,10 @@ $child_forums = apply_filters('wpforo_sub_forum_list_threaded_layout', $child_fo
34
 
35
  <div id="wpf-forums-<?php echo $cat['forumid'] ?>" class="wpf-cat-forums">
36
  <div class="wpf-cat-forum-list">
37
- <?php if(!empty($child_forums)): ?>
38
- <?php foreach($child_forums as $child_forumid): ?>
39
- <?php if($child_forumid == $cat['forumid'] || !WPF()->perm->forum_can('vf', $child_forumid) ) continue; $forum = wpforo_forum( $child_forumid ); ?>
40
- <div class="wpf-forum-item <?php wpforo_unread($child_forumid, 'forum'); ?>">
41
  <span class="wpf-circle wpf-s" style="border: 1px dashed <?php echo $forum['color'] ?>; color: <?php echo $forum['color'] ?>; display: inline-flex; margin-right: 8px;">
42
  <i class="<?php echo $forum['icon'] ?>"></i>
43
  </span>
15
 
16
  <?php
17
  $items_count = 0;
18
+ $childs = WPF()->forum->get_childs( $cat['forumid'] );
19
+ $childs[] = $cat['forumid'];
20
+ $args = array( 'row_count' => WPF()->forum->options['layout_threaded_intro_topics_count'], 'forumids' => $childs, 'orderby' => 'type, modified', 'order' => 'DESC' );
21
  $topics = WPF()->topic->get_topics( $args, $items_count );
22
  $load_more = $items_count >= WPF()->forum->options['layout_threaded_intro_topics_count'];
23
  if( !WPF()->forum->options['layout_threaded_display_subforums'] ){
24
  $args = array('parentid' => $cat['forumid']);
25
+ $childs = WPF()->forum->get_child_forums($cat['forumid']);
26
  }
27
+ $childs = apply_filters('wpforo_sub_forum_list_threaded_layout', $childs);
28
  ?>
29
 
30
  <div id="wpf-cat-<?php echo $cat['forumid'] ?>" class="wpfl-4">
34
 
35
  <div id="wpf-forums-<?php echo $cat['forumid'] ?>" class="wpf-cat-forums">
36
  <div class="wpf-cat-forum-list">
37
+ <?php if(!empty($childs)): ?>
38
+ <?php foreach($childs as $child): ?>
39
+ <?php if($child == $cat['forumid'] || !WPF()->perm->forum_can('vf', $child) ) continue; $forum = wpforo_forum( $child ); ?>
40
+ <div class="wpf-forum-item <?php wpforo_unread($child, 'forum'); ?>">
41
  <span class="wpf-circle wpf-s" style="border: 1px dashed <?php echo $forum['color'] ?>; color: <?php echo $forum['color'] ?>; display: inline-flex; margin-right: 8px;">
42
  <i class="<?php echo $forum['icon'] ?>"></i>
43
  </span>
wpf-themes/classic/layouts/4/forum.php CHANGED
@@ -15,16 +15,16 @@
15
 
16
  <?php
17
  $items_count = 0;
18
- $child_forums = array();
19
- WPF()->forum->get_childs( $cat['forumid'], $child_forums );
20
- $args = array( 'row_count' => WPF()->forum->options['layout_threaded_intro_topics_count'], 'forumids' => $child_forums, 'orderby' => 'type, modified', 'order' => 'DESC' );
21
  $topics = WPF()->topic->get_topics( $args, $items_count );
22
  $load_more = $items_count >= WPF()->forum->options['layout_threaded_intro_topics_count'];
23
  if( !WPF()->forum->options['layout_threaded_display_subforums'] ){
24
  $args = array('parentid' => $cat['forumid']);
25
- $child_forums = WPF()->forum->get_child_forums($cat['forumid']);
26
  }
27
- $child_forums = apply_filters('wpforo_forum_list_threaded_layout', $child_forums);
28
  ?>
29
 
30
  <div id="wpf-cat-<?php echo $cat['forumid'] ?>" class="wpfl-4">
@@ -49,10 +49,10 @@ $child_forums = apply_filters('wpforo_forum_list_threaded_layout', $child_forums
49
 
50
  <div id="wpf-forums-<?php echo $cat['forumid'] ?>" class="wpf-cat-forums" style="display: <?php echo (WPF()->forum->options['layout_threaded_intro_topics_toggle'] ? 'block' : 'none') ?>;">
51
  <div class="wpf-cat-forum-list">
52
- <?php if(!empty($child_forums)): ?>
53
- <?php foreach($child_forums as $child_forumid): ?>
54
- <?php if( $child_forumid == $cat['forumid'] || !WPF()->perm->forum_can('vf', $child_forumid) ) continue; $forum = wpforo_forum( $child_forumid ); ?>
55
- <div class="wpf-forum-item <?php wpforo_unread($child_forumid, 'forum'); ?>">
56
  <span class="wpf-circle wpf-s" style="border: 1px dashed <?php echo $forum['color'] ?>; color: <?php echo $forum['color'] ?>; display: inline-flex;">
57
  <i class="<?php echo $forum['icon'] ?>"></i>
58
  </span>
15
 
16
  <?php
17
  $items_count = 0;
18
+ $childs = WPF()->forum->get_childs( $cat['forumid'] );
19
+ $childs[] = $cat['forumid'];
20
+ $args = array( 'row_count' => WPF()->forum->options['layout_threaded_intro_topics_count'], 'forumids' => $childs, 'orderby' => 'type, modified', 'order' => 'DESC' );
21
  $topics = WPF()->topic->get_topics( $args, $items_count );
22
  $load_more = $items_count >= WPF()->forum->options['layout_threaded_intro_topics_count'];
23
  if( !WPF()->forum->options['layout_threaded_display_subforums'] ){
24
  $args = array('parentid' => $cat['forumid']);
25
+ $childs = WPF()->forum->get_child_forums($cat['forumid']);
26
  }
27
+ $childs = apply_filters('wpforo_forum_list_threaded_layout', $childs);
28
  ?>
29
 
30
  <div id="wpf-cat-<?php echo $cat['forumid'] ?>" class="wpfl-4">
49
 
50
  <div id="wpf-forums-<?php echo $cat['forumid'] ?>" class="wpf-cat-forums" style="display: <?php echo (WPF()->forum->options['layout_threaded_intro_topics_toggle'] ? 'block' : 'none') ?>;">
51
  <div class="wpf-cat-forum-list">
52
+ <?php if(!empty($childs)): ?>
53
+ <?php foreach($childs as $child) : ?>
54
+ <?php if( $child == $cat['forumid'] || !WPF()->perm->forum_can('vf', $child) ) continue; $forum = wpforo_forum( $child ); ?>
55
+ <div class="wpf-forum-item <?php wpforo_unread($child, 'forum'); ?>">
56
  <span class="wpf-circle wpf-s" style="border: 1px dashed <?php echo $forum['color'] ?>; color: <?php echo $forum['color'] ?>; display: inline-flex;">
57
  <i class="<?php echo $forum['icon'] ?>"></i>
58
  </span>
wpf-themes/classic/post.php CHANGED
@@ -31,7 +31,7 @@ if( WPF()->perm->forum_can('vt') && WPF()->perm->forum_can('ent') ):
31
 
32
  else : ?>
33
  <p class="wpf-p-error">
34
- <?php if(is_user_logged_in()): ?>
35
  <?php echo apply_filters('wpforo_no_topic_access_message_for_users', wpforo_phrase("Your user level does not have appropriate permission to view the content", false)); ?>
36
  <?php else: ?>
37
  <?php echo apply_filters('wpforo_no_topic_access_message_for_guests', wpforo_phrase("You do not have permission to view the content", false) . '<br>'. wpforo_get_login_or_register_notice_text()); ?>
31
 
32
  else : ?>
33
  <p class="wpf-p-error">
34
+ <?php if( WPF()->current_userid ): ?>
35
  <?php echo apply_filters('wpforo_no_topic_access_message_for_users', wpforo_phrase("Your user level does not have appropriate permission to view the content", false)); ?>
36
  <?php else: ?>
37
  <?php echo apply_filters('wpforo_no_topic_access_message_for_guests', wpforo_phrase("You do not have permission to view the content", false) . '<br>'. wpforo_get_login_or_register_notice_text()); ?>
wpf-themes/classic/profile-subscriptions.php CHANGED
@@ -26,7 +26,7 @@
26
  <tr<?php echo ( $bg ? ' class="wpfbg-9"' : '' ) ?>>
27
  <td class="sbn-icon"><i class="fas fa-1x <?php echo ($subscribe['type'] == 'forum') ? 'fa-comments' : 'fa-file-alt' ; ?>"></i></td>
28
  <td class="sbn-title"><a href="<?php echo esc_url($item_url) ?>"><?php echo esc_html($item['title']) ?></a></td>
29
- <?php if( WPF()->current_object['user_is_same_current_user'] ) : ?>
30
  <td class="sbn-action"><a href="<?php echo esc_url(WPF()->sbscrb->get_unsubscribe_link($subscribe['confirmkey'])) ?>"><?php wpforo_phrase('Unsubscribe'); ?></a></td>
31
  <?php else : ?>
32
  <td>&nbsp;</td>
26
  <tr<?php echo ( $bg ? ' class="wpfbg-9"' : '' ) ?>>
27
  <td class="sbn-icon"><i class="fas fa-1x <?php echo ($subscribe['type'] == 'forum') ? 'fa-comments' : 'fa-file-alt' ; ?>"></i></td>
28
  <td class="sbn-title"><a href="<?php echo esc_url($item_url) ?>"><?php echo esc_html($item['title']) ?></a></td>
29
+ <?php if( WPF()->current_object['user_is_same_current_user'] || wpforo_current_user_is('admin') ) : ?>
30
  <td class="sbn-action"><a href="<?php echo esc_url(WPF()->sbscrb->get_unsubscribe_link($subscribe['confirmkey'])) ?>"><?php wpforo_phrase('Unsubscribe'); ?></a></td>
31
  <?php else : ?>
32
  <td>&nbsp;</td>
wpforo.php CHANGED
@@ -5,14 +5,14 @@
5
  * Description: WordPress Forum plugin. wpForo is a full-fledged forum solution for your community. Comes with multiple modern forum layouts.
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
- * Version: 1.9.6
9
  * Text Domain: wpforo
10
  * Domain Path: /wpf-languages
11
  */
12
 
13
  //Exit if accessed directly
14
  if( !defined( 'ABSPATH' ) ) exit;
15
- if( !defined( 'WPFORO_VERSION' ) ) define('WPFORO_VERSION', '1.9.6');
16
 
17
  function wpforo_load_plugin_textdomain() { load_plugin_textdomain( 'wpforo', FALSE, basename( dirname( __FILE__ ) ) . '/wpf-languages/' ); }
18
  add_action( 'plugins_loaded', 'wpforo_load_plugin_textdomain' );
@@ -758,7 +758,7 @@ if( !class_exists( 'wpForo' ) ) {
758
  break;
759
  case 'logout':
760
  wp_logout();
761
- wp_redirect( wpforo_home_url( preg_replace('#\?.*$#is', '', wpforo_get_request_uri()) ) );
762
  exit();
763
  break;
764
  }
@@ -836,7 +836,7 @@ if( !class_exists( 'wpForo' ) ) {
836
  if($this->current_userid){
837
  $current_object['userid'] = $this->current_userid;
838
  }else{
839
- wp_redirect( wpforo_login_url() );
840
  exit();
841
  }
842
  }
@@ -923,7 +923,7 @@ if( !class_exists( 'wpForo' ) ) {
923
  if( $qvar0 = (int) wpfval($current_object['qvars'], 0) ){
924
  $forum = (array) $this->forum->get_forum($qvar0);
925
  if( !$forum || (int) wpfval($forum, 'is_cat') ){
926
- wp_redirect( wpforo_home_url( wpforo_get_template_slug('add-topic') ), 301 );
927
  exit();
928
  }
929
  }
@@ -977,7 +977,7 @@ if( !class_exists( 'wpForo' ) ) {
977
  }
978
  }else{
979
  if( !$this->current_userid ){
980
- wp_redirect( wpforo_login_url() );
981
  exit();
982
  }
983
  $current_object['is_404'] = true;
@@ -1002,7 +1002,7 @@ if( !class_exists( 'wpForo' ) ) {
1002
  ( wpfval($topic, 'status') && !$is_owner && !WPF()->perm->forum_can('au', $topic_forumid) )
1003
  ) ){
1004
  if( !$this->current_userid ){
1005
- wp_redirect( wpforo_login_url() );
1006
  exit();
1007
  }
1008
  $current_object['is_404'] = true;
@@ -1021,7 +1021,7 @@ if( !class_exists( 'wpForo' ) ) {
1021
  $args = ( empty($topic) ? array('slug' => $current_object['forum_slug']) : $topic['forumid'] );
1022
  if( $forum = $this->forum->get_forum( $args ) ){
1023
  if( !empty($topic) && strtolower($current_object['forum_slug']) !== strtolower($forum['slug']) ){
1024
- wp_redirect( $this->topic->get_topic_url($topic, $forum), 301 );
1025
  exit();
1026
  }
1027
  if( $forum['is_cat'] ) $current_object['template'] = 'forum';
@@ -1101,7 +1101,7 @@ if( !class_exists( 'wpForo' ) ) {
1101
  || ($this->current_object['template'] === 'post' && !$this->perm->forum_can('vt', $this->current_object['forumid']))
1102
  )
1103
  ){
1104
- wp_redirect( wpforo_login_url() );
1105
  exit();
1106
  }
1107
 
@@ -1112,7 +1112,7 @@ if( !class_exists( 'wpForo' ) ) {
1112
  && $this->current_object['paged'] > 1
1113
  && (($this->current_object['paged'] - 1) * $this->current_object['items_per_page']) >= $this->current_object['items_count']
1114
  ){
1115
- wp_redirect( $this->strip_url_paged_var( $this->current_url ), 301 );
1116
  exit();
1117
  }
1118
  }else{
5
  * Description: WordPress Forum plugin. wpForo is a full-fledged forum solution for your community. Comes with multiple modern forum layouts.
6
  * Author: gVectors Team
7
  * Author URI: https://gvectors.com/
8
+ * Version: 1.9.7
9
  * Text Domain: wpforo
10
  * Domain Path: /wpf-languages
11
  */
12
 
13
  //Exit if accessed directly
14
  if( !defined( 'ABSPATH' ) ) exit;
15
+ if( !defined( 'WPFORO_VERSION' ) ) define('WPFORO_VERSION', '1.9.7');
16
 
17
  function wpforo_load_plugin_textdomain() { load_plugin_textdomain( 'wpforo', FALSE, basename( dirname( __FILE__ ) ) . '/wpf-languages/' ); }
18
  add_action( 'plugins_loaded', 'wpforo_load_plugin_textdomain' );
758
  break;
759
  case 'logout':
760
  wp_logout();
761
+ wp_safe_redirect( wpforo_home_url( preg_replace('#\?.*$#is', '', wpforo_get_request_uri()) ) );
762
  exit();
763
  break;
764
  }
836
  if($this->current_userid){
837
  $current_object['userid'] = $this->current_userid;
838
  }else{
839
+ wp_safe_redirect( wpforo_login_url() );
840
  exit();
841
  }
842
  }
923
  if( $qvar0 = (int) wpfval($current_object['qvars'], 0) ){
924
  $forum = (array) $this->forum->get_forum($qvar0);
925
  if( !$forum || (int) wpfval($forum, 'is_cat') ){
926
+ wp_safe_redirect( wpforo_home_url( wpforo_get_template_slug('add-topic') ), 301 );
927
  exit();
928
  }
929
  }
977
  }
978
  }else{
979
  if( !$this->current_userid ){
980
+ wp_safe_redirect( wpforo_login_url() );
981
  exit();
982
  }
983
  $current_object['is_404'] = true;
1002
  ( wpfval($topic, 'status') && !$is_owner && !WPF()->perm->forum_can('au', $topic_forumid) )
1003
  ) ){
1004
  if( !$this->current_userid ){
1005
+ wp_safe_redirect( wpforo_login_url() );
1006
  exit();
1007
  }
1008
  $current_object['is_404'] = true;
1021
  $args = ( empty($topic) ? array('slug' => $current_object['forum_slug']) : $topic['forumid'] );
1022
  if( $forum = $this->forum->get_forum( $args ) ){
1023
  if( !empty($topic) && strtolower($current_object['forum_slug']) !== strtolower($forum['slug']) ){
1024
+ wp_safe_redirect( $this->topic->get_topic_url($topic, $forum), 301 );
1025
  exit();
1026
  }
1027
  if( $forum['is_cat'] ) $current_object['template'] = 'forum';
1101
  || ($this->current_object['template'] === 'post' && !$this->perm->forum_can('vt', $this->current_object['forumid']))
1102
  )
1103
  ){
1104
+ wp_safe_redirect( wpforo_login_url() );
1105
  exit();
1106
  }
1107
 
1112
  && $this->current_object['paged'] > 1
1113
  && (($this->current_object['paged'] - 1) * $this->current_object['items_per_page']) >= $this->current_object['items_count']
1114
  ){
1115
+ wp_safe_redirect( $this->strip_url_paged_var( $this->current_url ), 301 );
1116
  exit();
1117
  }
1118
  }else{