Advanced Database Cleaner - Version 3.0.3

Version Description

  • 06/10/2020 =
  • Tweak: Cleaning the code by deleting unused blocks of code
  • Tweak: Enhancing the security of the plugin
Download this release

Release Info

Developer symptote
Plugin Icon 128x128 Advanced Database Cleaner
Version 3.0.3
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.3

README.txt CHANGED
@@ -4,8 +4,8 @@ Donate Link: https://www.sigmaplugin.com/donation
4
  Tags: clean, clean up, cleanup, database, optimize, performance, speed, optimizing, clean-up, orphan, orphaned, tables, options
5
  Requires at least: 3.1.0
6
  Requires PHP: 5.0
7
- Tested up to: 5.5
8
- Stable tag: 3.0.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -85,6 +85,11 @@ Do you know that even after deleting a plugin/theme from your WordPress website,
85
 
86
  You are welcome to contribute to the plugin translation via the [WordPress translation website](https://translate.wordpress.org/projects/wp-plugins/advanced-database-cleaner).
87
 
 
 
 
 
 
88
  == Installation ==
89
 
90
  This section describes how to install the plugin. In general, there are 3 ways to install this plugin like any other WordPress plugin.
@@ -135,6 +140,10 @@ This section describes how to install the plugin. In general, there are 3 ways t
135
 
136
  == Changelog ==
137
 
 
 
 
 
138
  = 3.0.2 - 01/09/2020 =
139
  - Fix: fixing an issue in the general cleanup tab preventing users from deleting orphaned items
140
  - Tweak: we are now using SweetAlert for all popup boxes
4
  Tags: clean, clean up, cleanup, database, optimize, performance, speed, optimizing, clean-up, orphan, orphaned, tables, options
5
  Requires at least: 3.1.0
6
  Requires PHP: 5.0
7
+ Tested up to: 5.8
8
+ Stable tag: 3.0.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
85
 
86
  You are welcome to contribute to the plugin translation via the [WordPress translation website](https://translate.wordpress.org/projects/wp-plugins/advanced-database-cleaner).
87
 
88
+ = Thanks To =
89
+
90
+ * [Fabio Fava](https://profiles.wordpress.org/fabiofava) for translating the plugin to pt_BR
91
+ * [Julio Potier](https://profiles.wordpress.org/juliobox) for the security remarks
92
+
93
  == Installation ==
94
 
95
  This section describes how to install the plugin. In general, there are 3 ways to install this plugin like any other WordPress plugin.
140
 
141
  == Changelog ==
142
 
143
+ = 3.0.3 - 06/10/2020 =
144
+ - Tweak: Cleaning the code by deleting unused blocks of code
145
+ - Tweak: Enhancing the security of the plugin
146
+
147
  = 3.0.2 - 01/09/2020 =
148
  - Fix: fixing an issue in the general cleanup tab preventing users from deleting orphaned items
149
  - Tweak: we are now using SweetAlert for all popup boxes
advanced-db-cleaner.php CHANGED
@@ -5,7 +5,7 @@ if (!is_main_site()) return;
5
  Plugin Name: Advanced Database Cleaner
6
  Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
7
  Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
8
- Version: 3.0.2
9
  Author: Younes JFR.
10
  Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
@@ -29,8 +29,7 @@ class ADBC_Advanced_DB_Cleaner {
29
  public function __construct(){
30
 
31
  // Define common constants that should be modified in each version
32
- if(!defined("ADBC_PLUGIN_F_TYPE")) define("ADBC_PLUGIN_F_TYPE", "free");
33
- if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.2");
34
 
35
  // Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
36
  add_action('plugins_loaded', array($this, 'plugins_loaded'));
@@ -84,22 +83,7 @@ class ADBC_Advanced_DB_Cleaner {
84
  * Include functions and specific elements for pro version
85
  ********************************************************************/
86
  include_once 'includes/functions.php';
87
- if(ADBC_PLUGIN_F_TYPE == "pro"){
88
 
89
- // Include pro functions
90
- include_once 'includes/functions_pro.php';
91
-
92
- // In pro, register as well function for timeout
93
- register_shutdown_function('aDBc_shutdown_due_to_timeout');
94
-
95
- // Load license (Load only in pro version)
96
- include_once 'includes/license/adbc-edd-sample-plugin.php';
97
-
98
- // Add actions for searching and progress bar in pro
99
- add_action('wp_ajax_aDBc_new_run_search_for_items', 'aDBc_new_run_search_for_items');
100
- add_action('wp_ajax_aDBc_get_progress_bar_width', 'aDBc_get_progress_bar_width');
101
-
102
- }
103
 
104
  /**************************************************************************************************************
105
  *
@@ -131,55 +115,8 @@ class ADBC_Advanced_DB_Cleaner {
131
  $aDBc_upload_dir = wp_upload_dir();
132
  if(!defined("ADBC_UPLOAD_DIR_PATH")) define("ADBC_UPLOAD_DIR_PATH", str_replace('\\' ,'/', $aDBc_upload_dir['basedir']));
133
 
134
- /**************************************************************************************************************
135
- *
136
- * Define & create adbc upload folder or rename existing one by adding security code for versions < 3.1.0
137
- * In version >= 3.0.0 of ADBC, we will use files to store data instead of database
138
- * In version >= 3.1.0, we've added a unique security code to the end of the folder to prevent third parties accesssing files directly via URL
139
- *
140
- **************************************************************************************************************/
141
-
142
- if(ADBC_PLUGIN_F_TYPE == "pro"){
143
-
144
- $aDBc_security_folder_code = get_option('aDBc_security_folder_code');
145
-
146
- // If the security code does not exist, generate a new one and add it to the DB
147
- if(empty($aDBc_security_folder_code)){
148
-
149
- $permitted_chars = '00112233445566778899abcdefghijklmnopqrstuvwxyz';
150
- $aDBc_security_folder_code = substr(str_shuffle($permitted_chars), 0, 12);
151
- update_option('aDBc_security_folder_code', $aDBc_security_folder_code, "no");
152
- }
153
-
154
- // Define ADBC upload folder name with the security code
155
- if(!defined("ADBC_UPLOAD_DIR_PATH_TO_ADBC")) define("ADBC_UPLOAD_DIR_PATH_TO_ADBC", ADBC_UPLOAD_DIR_PATH . '/adbc_uploads_' . $aDBc_security_folder_code);
156
-
157
- // First, test of the old folder "/adbc_uploads" exists. If so, rename it by adding new security code
158
- if(file_exists(ADBC_UPLOAD_DIR_PATH . '/adbc_uploads')){
159
-
160
- rename(ADBC_UPLOAD_DIR_PATH . '/adbc_uploads', ADBC_UPLOAD_DIR_PATH . '/adbc_uploads_' . $aDBc_security_folder_code);
161
-
162
- }else {
163
- // If the old folder does not exist, then add the folder with security code
164
- if(!file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC)){
165
- aDBc_create_folder_plus_index_file(ADBC_UPLOAD_DIR_PATH_TO_ADBC);
166
- }
167
- }
168
-
169
- }
170
-
171
- /**************************************************************************************************************
172
- *
173
- * Try to increase the timeout of the server to 300 to prevent timeout errors and multiple loads while searching
174
- *
175
- **************************************************************************************************************/
176
-
177
  if(!defined("ADBC_ORIGINAL_TIMEOUT")) define("ADBC_ORIGINAL_TIMEOUT", ini_get('max_execution_time'));
178
- if(ADBC_PLUGIN_F_TYPE == "pro"){
179
- if(function_exists('set_time_limit') && ADBC_ORIGINAL_TIMEOUT < 300){
180
- @set_time_limit(300);
181
- }
182
- }
183
 
184
  // Add 'Database Cleaner' to Wordpress menu
185
  add_action('admin_menu', array($this, 'aDBc_add_admin_menu'));
@@ -330,62 +267,6 @@ class ADBC_Advanced_DB_Cleaner {
330
  delete_option('aDBc_tables_status');
331
  delete_option('aDBc_tasks_status');
332
 
333
- // These options are temp and should not exist after finishing the search of oprhans. We make sure to clean them just in case
334
- //$array_items = array('options','tables','tasks');
335
- //foreach($array_items as $item){
336
- //delete_option('aDBc_temp_last_iteration_' . $item);
337
- //delete_option('aDBc_temp_still_searching_' . $item);
338
- //delete_option('aDBc_temp_last_item_line_' . $item);
339
- //delete_option('aDBc_temp_last_file_line_' . $item);
340
- //delete_option('aDBc_last_search_ok_' . $item);
341
- //}
342
-
343
- // if we are in pro version, clean these ones
344
- if(ADBC_PLUGIN_F_TYPE == "pro"){
345
-
346
- // Get security code
347
- $aDBc_security_folder_code = get_option('aDBc_security_folder_code');
348
-
349
- // Delete folder containing search results having the security code
350
- $aDBc_upload_dir = wp_upload_dir();
351
- $aDBc_upload_dir = str_replace('\\' ,'/', $aDBc_upload_dir['basedir']) . '/adbc_uploads_' . $aDBc_security_folder_code;
352
- if(file_exists($aDBc_upload_dir)){
353
- $dir = opendir($aDBc_upload_dir);
354
- while(($file = readdir($dir)) !== false){
355
- if ($file != '.' && $file != '..'){
356
- unlink($aDBc_upload_dir . "/" . $file);
357
- }
358
- }
359
- closedir($dir);
360
- rmdir($aDBc_upload_dir);
361
- }
362
-
363
- // Just in case the old folder (in versions < 3.1.0) have not been cleaned for any reason, try to clean it
364
- $aDBc_upload_dir = wp_upload_dir();
365
- $aDBc_upload_dir = str_replace('\\' ,'/', $aDBc_upload_dir['basedir']) . '/adbc_uploads';
366
- if(file_exists($aDBc_upload_dir)){
367
- $dir = opendir($aDBc_upload_dir);
368
- while(($file = readdir($dir)) !== false){
369
- if ($file != '.' && $file != '..'){
370
- unlink($aDBc_upload_dir . "/" . $file);
371
- }
372
- }
373
- closedir($dir);
374
- rmdir($aDBc_upload_dir);
375
- }
376
-
377
- // Delete security code option
378
- delete_option('aDBc_security_folder_code');
379
- // Delete license options
380
- delete_option('aDBc_edd_license_key');
381
- delete_option('aDBc_edd_license_status');
382
- // Uninstall the license key? Maybe no need for deactivating the license!
383
- // if(!function_exists('aDBc_edd_deactivate_license_after_uninstall')){
384
- // include_once 'includes/license/adbc-edd-sample-plugin.php';
385
- // }
386
- // aDBc_edd_deactivate_license_after_uninstall();
387
- }
388
-
389
  // Options below are used by both free and pro version
390
  // Test if both version are installed to prevent deleting options
391
  if((file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner-pro") && file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner")) ||
@@ -561,9 +442,9 @@ class ADBC_Advanced_DB_Cleaner {
561
  if(!isset($_POST['aDBc_left_menu']) && !isset($_POST['aDBc_menu_under_tools'])){
562
  $aDBc_settings['left_menu'] = "1";
563
  }
564
- if(ADBC_PLUGIN_F_TYPE == "free"){
565
- $aDBc_settings['hide_premium_tab'] = isset($_POST['aDBc_hide_premium_tab']) ? "1" : "0";
566
- }
567
  // Update settings in DB
568
  update_option('aDBc_settings', $aDBc_settings, "no");
569
  }
@@ -591,13 +472,9 @@ class ADBC_Advanced_DB_Cleaner {
591
 
592
  <td width="100%">
593
  <div style="background:#fff;padding:10px;margin-bottom:10px;">
594
- <?php
595
- if(ADBC_PLUGIN_F_TYPE == 'free'){
596
- $aDBc_plugin_title = "Advanced DB Cleaner '" . ADBC_PLUGIN_VERSION . "'";
597
- }else{
598
- $aDBc_plugin_title = "Advanced DB Cleaner <b>PRO</b> '" . ADBC_PLUGIN_VERSION . "'";
599
- }
600
- ?>
601
  <div style="font-size: 20px;font-weight: 400;margin-bottom:10px"><?php echo $aDBc_plugin_title; ?></div>
602
  <div style="border-top:1px dashed #eee;padding-top:4px">
603
  <span class="aDBc-row-text"><?php _e('By', 'advanced-database-cleaner'); ?></span>
@@ -625,18 +502,18 @@ class ADBC_Advanced_DB_Cleaner {
625
  <h1 style="font-size:10px"></h1>
626
 
627
  <?php
628
- if(ADBC_PLUGIN_F_TYPE == 'pro' && !aDBc_edd_is_license_activated()){
629
- echo '<div class="aDBc-please-activate-msg notice is-dismissible"><p>' . __('Please activate your license key to get lifetime automatic updates and support.', 'advanced-database-cleaner') . " <a href='?page=advanced_db_cleaner&aDBc_tab=license'>" . __('Activate now', 'advanced-database-cleaner') . "</a>" . '</p></div>';
630
- }
 
631
  global $aDBc_settings;
632
 
633
  // This is a notice for premium users who will lose pro version when upgrading to 3.0.0 from an old version
634
- if(ADBC_PLUGIN_F_TYPE == 'free' && !empty($aDBc_settings['ignore_premium']) && $aDBc_settings['ignore_premium'] == "no"){
635
 
636
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
637
- $aDBc_new_URI = add_query_arg('ignore-premium-notice', 'yes', $aDBc_new_URI);
638
 
639
- ?>
640
  <div id="aDBc_main_msg" class="aDBc-premium-lost-msg">
641
  <span style="float:left;margin-bottom:20px"><?php _e('Important notice to premium users!', 'advanced-database-cleaner'); ?></span>
642
  <a style="text-decoration:none;float:right" href="<?php echo $aDBc_new_URI ?>">
@@ -650,15 +527,9 @@ class ADBC_Advanced_DB_Cleaner {
650
  </div>
651
  <?php
652
  }
653
-
654
- if(ADBC_PLUGIN_F_TYPE == 'free'){
655
- $aDBc_margin_class = "aDBc-margin-r-300";
656
- }else{
657
- $aDBc_margin_class = "";
658
- }
659
-
660
  ?>
661
- <div class="<?php echo $aDBc_margin_class; ?>">
 
662
  <div class="aDBc-tab-box">
663
  <?php
664
  $aDBc_tabs = array('general' => __('General clean-up', 'advanced-database-cleaner'),
@@ -666,28 +537,20 @@ class ADBC_Advanced_DB_Cleaner {
666
  'options' => __('Options', 'advanced-database-cleaner'),
667
  'cron' => __('Cron jobs', 'advanced-database-cleaner'),
668
  'overview' => __('Overview & settings', 'advanced-database-cleaner'),
669
- 'premium' => __('Premium', 'advanced-database-cleaner'),
670
- 'license' => __('License', 'advanced-database-cleaner')
671
  );
672
 
673
- // If we are in free version or if the user choosed to hide the premium tab, then hide it
674
- // Also hide license tab
675
- if(ADBC_PLUGIN_F_TYPE == "pro" || (!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab'] == "1")){
676
  unset($aDBc_tabs['premium']);
677
- }
678
-
679
- // If we are in free version, hide license tab
680
- if(ADBC_PLUGIN_F_TYPE == "free"){
681
- unset($aDBc_tabs['license']);
682
- }
683
 
684
  $aDBc_dashicons_css = array('general' => 'dashicons-format-aside dashicons',
685
  'tables' => 'dashicons-grid-view dashicons',
686
  'options' => 'dashicons-forms dashicons',
687
  'cron' => 'dashicons-backup dashicons',
688
  'overview' => 'dashicons-admin-settings dashicons',
689
- 'premium' => 'dashicons-awards dashicons',
690
- 'license' => 'dashicons-admin-network dashicons',
691
  );
692
 
693
  $current_tab = isset($_GET['aDBc_tab']) ? $_GET['aDBc_tab'] : 'general';
@@ -722,19 +585,14 @@ class ADBC_Advanced_DB_Cleaner {
722
  break;
723
  case 'premium' :
724
  include_once 'includes/premium_page.php';
725
- break;
726
- case 'license' :
727
- aDBc_edd_license_page();
728
  break;
729
  }
730
  echo '</div>';
731
  ?>
732
  </div>
733
 
734
- <!-- In pro version, don't show sidebar -->
735
- <?php if(ADBC_PLUGIN_F_TYPE == "free"){ ?>
736
- <div class="aDBc-sidebar"><?php include_once 'includes/sidebar.php'; ?></div>
737
- <?php } ?>
738
 
739
  </div>
740
  </div>
5
  Plugin Name: Advanced Database Cleaner
6
  Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
7
  Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
8
+ Version: 3.0.3
9
  Author: Younes JFR.
10
  Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
29
  public function __construct(){
30
 
31
  // Define common constants that should be modified in each version
32
+ if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.3");
 
33
 
34
  // Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
35
  add_action('plugins_loaded', array($this, 'plugins_loaded'));
83
  * Include functions and specific elements for pro version
84
  ********************************************************************/
85
  include_once 'includes/functions.php';
 
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  /**************************************************************************************************************
89
  *
115
  $aDBc_upload_dir = wp_upload_dir();
116
  if(!defined("ADBC_UPLOAD_DIR_PATH")) define("ADBC_UPLOAD_DIR_PATH", str_replace('\\' ,'/', $aDBc_upload_dir['basedir']));
117
 
118
+ // Max execution time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  if(!defined("ADBC_ORIGINAL_TIMEOUT")) define("ADBC_ORIGINAL_TIMEOUT", ini_get('max_execution_time'));
 
 
 
 
 
120
 
121
  // Add 'Database Cleaner' to Wordpress menu
122
  add_action('admin_menu', array($this, 'aDBc_add_admin_menu'));
267
  delete_option('aDBc_tables_status');
268
  delete_option('aDBc_tasks_status');
269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  // Options below are used by both free and pro version
271
  // Test if both version are installed to prevent deleting options
272
  if((file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner-pro") && file_exists(WP_PLUGIN_DIR . "/advanced-database-cleaner")) ||
442
  if(!isset($_POST['aDBc_left_menu']) && !isset($_POST['aDBc_menu_under_tools'])){
443
  $aDBc_settings['left_menu'] = "1";
444
  }
445
+
446
+ $aDBc_settings['hide_premium_tab'] = isset($_POST['aDBc_hide_premium_tab']) ? "1" : "0";
447
+
448
  // Update settings in DB
449
  update_option('aDBc_settings', $aDBc_settings, "no");
450
  }
472
 
473
  <td width="100%">
474
  <div style="background:#fff;padding:10px;margin-bottom:10px;">
475
+
476
+ <?php $aDBc_plugin_title = "Advanced DB Cleaner '" . ADBC_PLUGIN_VERSION . "'"; ?>
477
+
 
 
 
 
478
  <div style="font-size: 20px;font-weight: 400;margin-bottom:10px"><?php echo $aDBc_plugin_title; ?></div>
479
  <div style="border-top:1px dashed #eee;padding-top:4px">
480
  <span class="aDBc-row-text"><?php _e('By', 'advanced-database-cleaner'); ?></span>
502
  <h1 style="font-size:10px"></h1>
503
 
504
  <?php
505
+ // zzz
506
+ $activate_license = __('Please activate your license key to get lifetime automatic updates and support.', 'advanced-database-cleaner');
507
+ $activate_now = __('Activate now', 'advanced-database-cleaner');
508
+
509
  global $aDBc_settings;
510
 
511
  // This is a notice for premium users who will lose pro version when upgrading to 3.0.0 from an old version
512
+ if(!empty($aDBc_settings['ignore_premium']) && $aDBc_settings['ignore_premium'] == "no"){
513
 
514
  $aDBc_new_URI = $_SERVER['REQUEST_URI'];
515
+ $aDBc_new_URI = add_query_arg('ignore-premium-notice', 'yes', $aDBc_new_URI); ?>
516
 
 
517
  <div id="aDBc_main_msg" class="aDBc-premium-lost-msg">
518
  <span style="float:left;margin-bottom:20px"><?php _e('Important notice to premium users!', 'advanced-database-cleaner'); ?></span>
519
  <a style="text-decoration:none;float:right" href="<?php echo $aDBc_new_URI ?>">
527
  </div>
528
  <?php
529
  }
 
 
 
 
 
 
 
530
  ?>
531
+
532
+ <div class="aDBc-margin-r-300">
533
  <div class="aDBc-tab-box">
534
  <?php
535
  $aDBc_tabs = array('general' => __('General clean-up', 'advanced-database-cleaner'),
537
  'options' => __('Options', 'advanced-database-cleaner'),
538
  'cron' => __('Cron jobs', 'advanced-database-cleaner'),
539
  'overview' => __('Overview & settings', 'advanced-database-cleaner'),
540
+ 'premium' => __('Premium', 'advanced-database-cleaner')
 
541
  );
542
 
543
+ // if the user choosed to hide the premium tab, then hide it
544
+ if(!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab'] == "1"){
 
545
  unset($aDBc_tabs['premium']);
546
+ }
 
 
 
 
 
547
 
548
  $aDBc_dashicons_css = array('general' => 'dashicons-format-aside dashicons',
549
  'tables' => 'dashicons-grid-view dashicons',
550
  'options' => 'dashicons-forms dashicons',
551
  'cron' => 'dashicons-backup dashicons',
552
  'overview' => 'dashicons-admin-settings dashicons',
553
+ 'premium' => 'dashicons-awards dashicons'
 
554
  );
555
 
556
  $current_tab = isset($_GET['aDBc_tab']) ? $_GET['aDBc_tab'] : 'general';
585
  break;
586
  case 'premium' :
587
  include_once 'includes/premium_page.php';
 
 
 
588
  break;
589
  }
590
  echo '</div>';
591
  ?>
592
  </div>
593
 
594
+ <!-- sidebar -->
595
+ <div class="aDBc-sidebar"><?php include_once 'includes/sidebar.php'; ?></div>
 
 
596
 
597
  </div>
598
  </div>
includes/class_clean_cron.php CHANGED
@@ -176,12 +176,20 @@ class ADBC_Tasks_List extends WP_List_Table {
176
  /** WP: Process bulk actions */
177
  public function process_bulk_action() {
178
  // security check!
179
- if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
180
- $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
181
- $action = 'bulk-' . $this->_args['plural'];
182
- if (!wp_verify_nonce( $nonce, $action))
183
- wp_die('Security check failed!');
184
- }
 
 
 
 
 
 
 
 
185
  $action = $this->current_action();
186
 
187
  if($action == 'delete'){
@@ -287,15 +295,10 @@ class ADBC_Tasks_List extends WP_List_Table {
287
  ?>
288
  <div class="aDBc-content-max-width">
289
 
290
- <!-- Print a notice/warning according to each type of tasks -->
291
  <?php
292
- if(ADBC_PLUGIN_F_TYPE == "pro"){
293
- if($_GET['aDBc_cat'] == 'o' && $this->aDBc_options_categories_info['o']['count'] > 0){
294
- echo '<div class="aDBc-box-warning-orphan">' . __('Tasks below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
295
- }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_tasks_categories_info['u']['count'] > 0){
296
- echo '<div class="aDBc-box-info">' . __('Some of your tasks are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
297
- }
298
- }
299
  ?>
300
 
301
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
@@ -319,21 +322,10 @@ class ADBC_Tasks_List extends WP_List_Table {
319
  <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
320
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
321
 
322
- <?php
323
- if(ADBC_PLUGIN_F_TYPE == "free"){
324
- ?>
325
  <div class="aDBc_premium_tooltip">
326
  <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
327
  <span style="width:380px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tasks','advanced-database-cleaner') ?></span>
328
  </div>
329
- <?php
330
- }else { ?>
331
-
332
- <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
333
-
334
- <?php
335
- }
336
- ?>
337
 
338
  </div>
339
 
@@ -350,7 +342,7 @@ class ADBC_Tasks_List extends WP_List_Table {
350
  <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
351
 
352
  <?php
353
- if(ADBC_PLUGIN_F_TYPE == "pro" || $abreviation == "all"|| $abreviation == "u"){
354
  $aDBc_link_style = "color:" . $category_info['color'];
355
  $aDBc_category_info_count = "(". $category_info['count'] . ")";
356
  }else{
@@ -365,7 +357,7 @@ class ADBC_Tasks_List extends WP_List_Table {
365
  <span><?php echo $category_info['name']; ?></span>
366
  <span><?php echo $aDBc_category_info_count ;?></span>
367
  </a>
368
- <?php if(ADBC_PLUGIN_F_TYPE == "free" && $abreviation != "all" && $abreviation != "u"){ ?>
369
  <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
370
  <?php } ?>
371
  </span>
176
  /** WP: Process bulk actions */
177
  public function process_bulk_action() {
178
  // security check!
179
+ if (isset($_POST['_wpnonce']) && !empty($_POST['_wpnonce'])){
180
+ $nonce = filter_input(INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING);
181
+ $action = 'bulk-' . $this->_args['plural'];
182
+ if (!wp_verify_nonce( $nonce, $action))
183
+ wp_die('Security check failed!');
184
+ }else{
185
+ // If $_POST['_wpnonce'] is not set, return
186
+ return;
187
+ }
188
+
189
+ // Check role
190
+ if(!current_user_can('administrator'))
191
+ wp_die('Security check failed!');
192
+
193
  $action = $this->current_action();
194
 
195
  if($action == 'delete'){
295
  ?>
296
  <div class="aDBc-content-max-width">
297
 
 
298
  <?php
299
+ // zzz
300
+ $msg1 = __('Tasks below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner');
301
+ $msg2 = __('Some of your tasks are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner');
 
 
 
 
302
  ?>
303
 
304
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
322
  <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
323
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
324
 
 
 
 
325
  <div class="aDBc_premium_tooltip">
326
  <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
327
  <span style="width:380px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tasks','advanced-database-cleaner') ?></span>
328
  </div>
 
 
 
 
 
 
 
 
329
 
330
  </div>
331
 
342
  <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
343
 
344
  <?php
345
+ if($abreviation == "all"|| $abreviation == "u"){
346
  $aDBc_link_style = "color:" . $category_info['color'];
347
  $aDBc_category_info_count = "(". $category_info['count'] . ")";
348
  }else{
357
  <span><?php echo $category_info['name']; ?></span>
358
  <span><?php echo $aDBc_category_info_count ;?></span>
359
  </a>
360
+ <?php if($abreviation != "all" && $abreviation != "u"){ ?>
361
  <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
362
  <?php } ?>
363
  </span>
includes/class_clean_options.php CHANGED
@@ -186,7 +186,15 @@ class ADBC_Options_List extends WP_List_Table {
186
  $action = 'bulk-' . $this->_args['plural'];
187
  if (!wp_verify_nonce( $nonce, $action))
188
  wp_die('Security check failed!');
189
- }
 
 
 
 
 
 
 
 
190
  $action = $this->current_action();
191
 
192
  if($action == 'delete'){
@@ -325,17 +333,6 @@ class ADBC_Options_List extends WP_List_Table {
325
  ?>
326
  <div class="aDBc-content-max-width">
327
 
328
- <!-- Print a notice/warning according to each type of options -->
329
- <?php
330
- if(ADBC_PLUGIN_F_TYPE == "pro"){
331
- if($_GET['aDBc_cat'] == 'o' && $this->aDBc_options_categories_info['o']['count'] > 0){
332
- echo '<div class="aDBc-box-warning-orphan">' . __('Options below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
333
- }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_options_categories_info['u']['count'] > 0){
334
- echo '<div class="aDBc-box-info">' . __('Some of your options are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
335
- }
336
- }
337
- ?>
338
-
339
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
340
 
341
  <!-- Code for "run new search" button + Show loading image -->
@@ -357,21 +354,10 @@ class ADBC_Options_List extends WP_List_Table {
357
  <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
358
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
359
 
360
- <?php
361
- if(ADBC_PLUGIN_F_TYPE == "free"){
362
- ?>
363
  <div class="aDBc_premium_tooltip">
364
  <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
365
  <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned options','advanced-database-cleaner') ?></span>
366
  </div>
367
- <?php
368
- }else { ?>
369
-
370
- <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
371
-
372
- <?php
373
- }
374
- ?>
375
 
376
  </div>
377
 
@@ -388,7 +374,7 @@ class ADBC_Options_List extends WP_List_Table {
388
  <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
389
 
390
  <?php
391
- if(ADBC_PLUGIN_F_TYPE == "pro" || $abreviation == "all"|| $abreviation == "u"){
392
  $aDBc_link_style = "color:" . $category_info['color'];
393
  $aDBc_category_info_count = "(". $category_info['count'] . ")";
394
  }else{
@@ -403,7 +389,7 @@ class ADBC_Options_List extends WP_List_Table {
403
  <span><?php echo $category_info['name']; ?></span>
404
  <span><?php echo $aDBc_category_info_count ;?></span>
405
  </a>
406
- <?php if(ADBC_PLUGIN_F_TYPE == "free" && $abreviation != "all" && $abreviation != "u"){ ?>
407
  <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
408
  <?php } ?>
409
  </span>
186
  $action = 'bulk-' . $this->_args['plural'];
187
  if (!wp_verify_nonce( $nonce, $action))
188
  wp_die('Security check failed!');
189
+ }else{
190
+ // If $_POST['_wpnonce'] is not set, return
191
+ return;
192
+ }
193
+
194
+ // Check role
195
+ if(!current_user_can('administrator'))
196
+ wp_die('Security check failed!');
197
+
198
  $action = $this->current_action();
199
 
200
  if($action == 'delete'){
333
  ?>
334
  <div class="aDBc-content-max-width">
335
 
 
 
 
 
 
 
 
 
 
 
 
336
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
337
 
338
  <!-- Code for "run new search" button + Show loading image -->
354
  <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
355
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
356
 
 
 
 
357
  <div class="aDBc_premium_tooltip">
358
  <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
359
  <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned options','advanced-database-cleaner') ?></span>
360
  </div>
 
 
 
 
 
 
 
 
361
 
362
  </div>
363
 
374
  <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
375
 
376
  <?php
377
+ if($abreviation == "all"|| $abreviation == "u"){
378
  $aDBc_link_style = "color:" . $category_info['color'];
379
  $aDBc_category_info_count = "(". $category_info['count'] . ")";
380
  }else{
389
  <span><?php echo $category_info['name']; ?></span>
390
  <span><?php echo $aDBc_category_info_count ;?></span>
391
  </a>
392
+ <?php if($abreviation != "all" && $abreviation != "u"){ ?>
393
  <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
394
  <?php } ?>
395
  </span>
includes/class_clean_tables.php CHANGED
@@ -270,7 +270,15 @@ class ADBC_Tables_List extends WP_List_Table {
270
  $action = 'bulk-' . $this->_args['plural'];
271
  if (!wp_verify_nonce( $nonce, $action))
272
  wp_die('Security check failed!');
273
- }
 
 
 
 
 
 
 
 
274
  $action = $this->current_action();
275
 
276
  // Prepare an array containing names of tables deleted
@@ -290,10 +298,6 @@ class ADBC_Tables_List extends WP_List_Table {
290
  array_push($names_deleted, $table_name);
291
  }
292
  }
293
- // After deleting tables, delete names also from file categorization
294
- if(ADBC_PLUGIN_F_TYPE == "pro"){
295
- aDBc_refresh_categorization_file_after_delete($names_deleted, 'tables');
296
- }
297
 
298
  // Update the message to show to the user
299
  $this->aDBc_message = __('Selected tables cleaned successfully!', 'advanced-database-cleaner');
@@ -387,17 +391,6 @@ class ADBC_Tables_List extends WP_List_Table {
387
  ?>
388
  <div class="aDBc-content-max-width">
389
 
390
- <!-- Print a notice/warning according to each type of tables -->
391
- <?php
392
- if(ADBC_PLUGIN_F_TYPE == "pro"){
393
- if($_GET['aDBc_cat'] == 'o' && $this->aDBc_tables_categories_info['o']['count'] > 0){
394
- echo '<div class="aDBc-box-warning-orphan">' . __('Tables below seem to be orphan! However, please delete only those you are sure to be orphan!','advanced-database-cleaner') . '</div>';
395
- }else if(($_GET['aDBc_cat'] == 'all' || $_GET['aDBc_cat'] == 'u') && $this->aDBc_tables_categories_info['u']['count'] > 0){
396
- echo '<div class="aDBc-box-info">' . __('Some of your tables are not categorized yet! Please click on the button below to categorize them!','advanced-database-cleaner') . '</div>';
397
- }
398
- }
399
- ?>
400
-
401
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
402
 
403
  <!-- Code for "run new search" button + Show loading image -->
@@ -419,21 +412,10 @@ class ADBC_Tables_List extends WP_List_Table {
419
  <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
420
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
421
 
422
- <?php
423
- if(ADBC_PLUGIN_F_TYPE == "free"){
424
- ?>
425
  <div class="aDBc_premium_tooltip">
426
  <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
427
  <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tables','advanced-database-cleaner') ?></span>
428
  </div>
429
- <?php
430
- }else { ?>
431
-
432
- <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" />
433
-
434
- <?php
435
- }
436
- ?>
437
 
438
  </div>
439
 
@@ -450,7 +432,7 @@ class ADBC_Tables_List extends WP_List_Table {
450
  <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
451
 
452
  <?php
453
- if(ADBC_PLUGIN_F_TYPE == "pro" || $abreviation == "all"|| $abreviation == "u"){
454
  $aDBc_link_style = "color:" . $category_info['color'];
455
  $aDBc_category_info_count = "(". $category_info['count'] . ")";
456
  }else{
@@ -465,7 +447,7 @@ class ADBC_Tables_List extends WP_List_Table {
465
  <span><?php echo $category_info['name']; ?></span>
466
  <span><?php echo $aDBc_category_info_count ;?></span>
467
  </a>
468
- <?php if(ADBC_PLUGIN_F_TYPE == "free" && $abreviation != "all" && $abreviation != "u"){ ?>
469
  <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
470
  <?php } ?>
471
  </span>
270
  $action = 'bulk-' . $this->_args['plural'];
271
  if (!wp_verify_nonce( $nonce, $action))
272
  wp_die('Security check failed!');
273
+ }else{
274
+ // If $_POST['_wpnonce'] is not set, return
275
+ return;
276
+ }
277
+
278
+ // Check role
279
+ if(!current_user_can('administrator'))
280
+ wp_die('Security check failed!');
281
+
282
  $action = $this->current_action();
283
 
284
  // Prepare an array containing names of tables deleted
298
  array_push($names_deleted, $table_name);
299
  }
300
  }
 
 
 
 
301
 
302
  // Update the message to show to the user
303
  $this->aDBc_message = __('Selected tables cleaned successfully!', 'advanced-database-cleaner');
391
  ?>
392
  <div class="aDBc-content-max-width">
393
 
 
 
 
 
 
 
 
 
 
 
 
394
  <div class="aDBc-clear-both" style="margin-top:15px"></div>
395
 
396
  <!-- Code for "run new search" button + Show loading image -->
412
  <input type="hidden" id="aDBc_still_searching" value="<?php echo $still_searching; ?>"/>
413
  <input type="hidden" id="aDBc_iteration" value="<?php echo $iteration; ?>"/>
414
 
 
 
 
415
  <div class="aDBc_premium_tooltip">
416
  <input id="aDBc_new_search_button" type="submit" class="aDBc-run-new-search" value="<?php echo $aDBc_search_text; ?>" name="aDBc_new_search_button" style="opacity:0.5" disabled/>
417
  <span style="width:390px" class="aDBc_premium_tooltiptext"><?php _e('Please <a href="?page=advanced_db_cleaner&aDBc_tab=premium">upgrade</a> to Pro to categorize and detect orphaned tables','advanced-database-cleaner') ?></span>
418
  </div>
 
 
 
 
 
 
 
 
419
 
420
  </div>
421
 
432
  <span class="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'aDBc-selected-category' : ''?>" style="<?php echo $abreviation == $_GET['aDBc_cat'] ? 'border-bottom: 1px solid ' . $category_info['color'] : '' ?>">
433
 
434
  <?php
435
+ if($abreviation == "all"|| $abreviation == "u"){
436
  $aDBc_link_style = "color:" . $category_info['color'];
437
  $aDBc_category_info_count = "(". $category_info['count'] . ")";
438
  }else{
447
  <span><?php echo $category_info['name']; ?></span>
448
  <span><?php echo $aDBc_category_info_count ;?></span>
449
  </a>
450
+ <?php if($abreviation != "all" && $abreviation != "u"){ ?>
451
  <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
452
  <?php } ?>
453
  </span>
includes/class_general_cleanup.php CHANGED
@@ -265,8 +265,17 @@ class ADBC_Clean_DB_List extends WP_List_Table {
265
  $action = 'bulk-' . $this->_args['plural'];
266
  if (!wp_verify_nonce( $nonce, $action))
267
  wp_die('Security check failed!');
268
- }
 
 
 
 
 
 
 
 
269
  $action = $this->current_action();
 
270
  if($action == 'clean'){
271
 
272
  // If the user wants to clean the elements he/she selected
265
  $action = 'bulk-' . $this->_args['plural'];
266
  if (!wp_verify_nonce( $nonce, $action))
267
  wp_die('Security check failed!');
268
+ }else{
269
+ // If $_POST['_wpnonce'] is not set, return
270
+ return;
271
+ }
272
+
273
+ // Check role
274
+ if(!current_user_can('administrator'))
275
+ wp_die('Security check failed!');
276
+
277
  $action = $this->current_action();
278
+
279
  if($action == 'clean'){
280
 
281
  // If the user wants to clean the elements he/she selected
includes/custom-clean-view/class_clean_comment.php CHANGED
@@ -68,9 +68,6 @@ class ADBC_Clean_Comment extends WP_List_Table {
68
  }
69
 
70
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
71
- if(ADBC_PLUGIN_F_TYPE == "pro"){
72
- $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("comment_author", "comment_content");
73
- }
74
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("comment_ID");
75
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
76
 
@@ -258,8 +255,17 @@ class ADBC_Clean_Comment extends WP_List_Table {
258
  $action = 'bulk-' . $this->_args['plural'];
259
  if (!wp_verify_nonce( $nonce, $action))
260
  wp_die('Security check failed!');
261
- }
 
 
 
 
 
 
 
 
262
  $action = $this->current_action();
 
263
  if($action == 'clean'){
264
  // If the user wants to clean the elements he/she selected
265
  if(isset($_POST['aDBc_elements_to_process'])){
68
  }
69
 
70
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
 
 
 
71
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("comment_ID");
72
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
73
 
255
  $action = 'bulk-' . $this->_args['plural'];
256
  if (!wp_verify_nonce( $nonce, $action))
257
  wp_die('Security check failed!');
258
+ }else{
259
+ // If $_POST['_wpnonce'] is not set, return
260
+ return;
261
+ }
262
+
263
+ // Check role
264
+ if(!current_user_can('administrator'))
265
+ wp_die('Security check failed!');
266
+
267
  $action = $this->current_action();
268
+
269
  if($action == 'clean'){
270
  // If the user wants to clean the elements he/she selected
271
  if(isset($_POST['aDBc_elements_to_process'])){
includes/custom-clean-view/class_clean_meta_comment_post_user_term.php CHANGED
@@ -59,9 +59,6 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
59
  }
60
 
61
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
62
- if(ADBC_PLUGIN_F_TYPE == "pro"){
63
- $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("meta_key", "meta_value");
64
- }
65
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg($this->aDBc_metaid_or_umetaid);
66
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
67
 
@@ -242,8 +239,17 @@ class ADBC_Clean_Meta_Comment_Post_User_Term extends WP_List_Table {
242
  $action = 'bulk-' . $this->_args['plural'];
243
  if (!wp_verify_nonce( $nonce, $action))
244
  wp_die('Security check failed!');
245
- }
 
 
 
 
 
 
 
 
246
  $action = $this->current_action();
 
247
  if($action == 'clean'){
248
  // If the user wants to clean the elements he/she selected
249
  if(isset($_POST['aDBc_elements_to_process'])){
59
  }
60
 
61
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
 
 
 
62
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg($this->aDBc_metaid_or_umetaid);
63
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
64
 
239
  $action = 'bulk-' . $this->_args['plural'];
240
  if (!wp_verify_nonce( $nonce, $action))
241
  wp_die('Security check failed!');
242
+ }else{
243
+ // If $_POST['_wpnonce'] is not set, return
244
+ return;
245
+ }
246
+
247
+ // Check role
248
+ if(!current_user_can('administrator'))
249
+ wp_die('Security check failed!');
250
+
251
  $action = $this->current_action();
252
+
253
  if($action == 'clean'){
254
  // If the user wants to clean the elements he/she selected
255
  if(isset($_POST['aDBc_elements_to_process'])){
includes/custom-clean-view/class_clean_relationships.php CHANGED
@@ -22,9 +22,6 @@ class ADBC_Clean_Relationship extends WP_List_Table {
22
  $this->aDBc_plural_title = __('Orphaned Relationships', 'advanced-database-cleaner');
23
 
24
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
25
- if(ADBC_PLUGIN_F_TYPE == "pro"){
26
- $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("term_taxonomy_id", "term_order");
27
- }
28
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("object_id");
29
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
30
 
@@ -192,8 +189,17 @@ class ADBC_Clean_Relationship extends WP_List_Table {
192
  $action = 'bulk-' . $this->_args['plural'];
193
  if (!wp_verify_nonce( $nonce, $action))
194
  wp_die('Security check failed!');
195
- }
 
 
 
 
 
 
 
 
196
  $action = $this->current_action();
 
197
  if($action == 'clean'){
198
  // If the user wants to clean the elements he/she selected
199
  if(isset($_POST['aDBc_elements_to_process'])){
22
  $this->aDBc_plural_title = __('Orphaned Relationships', 'advanced-database-cleaner');
23
 
24
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
 
 
 
25
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("object_id");
26
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
27
 
189
  $action = 'bulk-' . $this->_args['plural'];
190
  if (!wp_verify_nonce( $nonce, $action))
191
  wp_die('Security check failed!');
192
+ }else{
193
+ // If $_POST['_wpnonce'] is not set, return
194
+ return;
195
+ }
196
+
197
+ // Check role
198
+ if(!current_user_can('administrator'))
199
+ wp_die('Security check failed!');
200
+
201
  $action = $this->current_action();
202
+
203
  if($action == 'clean'){
204
  // If the user wants to clean the elements he/she selected
205
  if(isset($_POST['aDBc_elements_to_process'])){
includes/custom-clean-view/class_clean_revision_draft_trash.php CHANGED
@@ -50,9 +50,6 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
50
  }
51
 
52
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
53
- if(ADBC_PLUGIN_F_TYPE == "pro"){
54
- $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("post_title", "post_content");
55
- }
56
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("ID");
57
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
58
 
@@ -239,8 +236,17 @@ class ADBC_Clean_Revision_Trash_Draft extends WP_List_Table {
239
  $action = 'bulk-' . $this->_args['plural'];
240
  if (!wp_verify_nonce( $nonce, $action))
241
  wp_die('Security check failed!');
242
- }
 
 
 
 
 
 
 
 
243
  $action = $this->current_action();
 
244
  if($action == 'clean'){
245
  // If the user wants to clean the elements he/she selected
246
  if(isset($_POST['aDBc_elements_to_process'])){
50
  }
51
 
52
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
 
 
 
53
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("ID");
54
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
55
 
236
  $action = 'bulk-' . $this->_args['plural'];
237
  if (!wp_verify_nonce( $nonce, $action))
238
  wp_die('Security check failed!');
239
+ }else{
240
+ // If $_POST['_wpnonce'] is not set, return
241
+ return;
242
+ }
243
+
244
+ // Check role
245
+ if(!current_user_can('administrator'))
246
+ wp_die('Security check failed!');
247
+
248
  $action = $this->current_action();
249
+
250
  if($action == 'clean'){
251
  // If the user wants to clean the elements he/she selected
252
  if(isset($_POST['aDBc_elements_to_process'])){
includes/custom-clean-view/class_clean_transient.php CHANGED
@@ -38,9 +38,6 @@ class ADBC_Clean_Transient extends WP_List_Table {
38
  }
39
 
40
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
41
- if(ADBC_PLUGIN_F_TYPE == "pro"){
42
- $this->aDBc_search_sql_arg = aDBc_get_search_sql_arg("a.option_name", "a.option_value");
43
- }
44
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("a.option_id");
45
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
46
 
@@ -252,8 +249,17 @@ class ADBC_Clean_Transient extends WP_List_Table {
252
  $action = 'bulk-' . $this->_args['plural'];
253
  if (!wp_verify_nonce( $nonce, $action))
254
  wp_die('Security check failed!');
255
- }
 
 
 
 
 
 
 
 
256
  $action = $this->current_action();
 
257
  if($action == 'clean'){
258
  // If the user wants to clean the elements he/she selected
259
  if(isset($_POST['aDBc_elements_to_process'])){
38
  }
39
 
40
  // Prepare additional sql args if any: per page, LIMIT, OFFSET, etc.
 
 
 
41
  $this->aDBc_order_by_sql_arg = aDBc_get_order_by_sql_arg("a.option_id");
42
  $this->aDBc_limit_offset_sql_arg = aDBc_get_limit_offset_sql_args();
43
 
249
  $action = 'bulk-' . $this->_args['plural'];
250
  if (!wp_verify_nonce( $nonce, $action))
251
  wp_die('Security check failed!');
252
+ }else{
253
+ // If $_POST['_wpnonce'] is not set, return
254
+ return;
255
+ }
256
+
257
+ // Check role
258
+ if(!current_user_can('administrator'))
259
+ wp_die('Security check failed!');
260
+
261
  $action = $this->current_action();
262
+
263
  if($action == 'clean'){
264
  // If the user wants to clean the elements he/she selected
265
  if(isset($_POST['aDBc_elements_to_process'])){
includes/custom-clean-view/header_page_custom_clean.php CHANGED
@@ -14,20 +14,11 @@
14
 
15
  <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
16
 
17
- <?php
18
- if(ADBC_PLUGIN_F_TYPE == "free"){
19
- $aDBc_form_style = "pointer-events:none;opacity:0.5";
20
-
21
- }else{
22
- $aDBc_form_style = "";
23
- }
24
- ?>
25
-
26
  <div style="float:left;padding:8px;height:30px">
27
 
28
  <span class="aDBc_premium_tooltip">
29
 
30
- <form style="float:left;<?php echo $aDBc_form_style ?>" method="get">
31
 
32
  <?php
33
  // Generate current parameters in URL
@@ -54,9 +45,7 @@
54
 
55
  </form>
56
 
57
- <?php if(ADBC_PLUGIN_F_TYPE == "free"){ ?>
58
- <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
59
- <?php } ?>
60
 
61
  </span>
62
  </div>
14
 
15
  <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
16
 
 
 
 
 
 
 
 
 
 
17
  <div style="float:left;padding:8px;height:30px">
18
 
19
  <span class="aDBc_premium_tooltip">
20
 
21
+ <form style="float:left;pointer-events:none;opacity:0.5" method="get">
22
 
23
  <?php
24
  // Generate current parameters in URL
45
 
46
  </form>
47
 
48
+ <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
 
 
49
 
50
  </span>
51
  </div>
includes/functions.php CHANGED
@@ -603,11 +603,7 @@ function aDBc_prepare_items_to_display(
603
  }
604
 
605
  // Filter results according to users choices and args
606
- if(ADBC_PLUGIN_F_TYPE == "pro"){
607
- aDBc_filter_results_in_all_items_array($aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair);
608
- }else{
609
- aDBc_filter_results_in_all_items_array_free($aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair);
610
- }
611
 
612
  // Put 'u' type to all uncategorized items and count all items
613
  foreach($aDBc_all_items as $item_name => $item_info){
@@ -647,13 +643,8 @@ function aDBc_prepare_items_to_display(
647
 
648
  switch($item_info['type']){
649
  case 'u' :
650
- if(ADBC_PLUGIN_F_TYPE == "free"){
651
- $belongs_to_without_html = __('Available in Pro version!', 'advanced-database-cleaner');
652
- $belongs_to = '<span style="color:#999">' . $belongs_to_without_html . '</span>';
653
- }else{
654
- $belongs_to_without_html = __('Uncategorised!', 'advanced-database-cleaner');
655
- $belongs_to = '<span style="color:#999">' . $belongs_to_without_html . '</span>' . $aDBc_not_categorized_toolip;
656
- }
657
  break;
658
  case 'o' :
659
  $belongs_to_without_html = __('Orphan!', 'advanced-database-cleaner');
603
  }
604
 
605
  // Filter results according to users choices and args
606
+ aDBc_filter_results_in_all_items_array_free($aDBc_all_items, $aDBc_tables_name_to_optimize, $aDBc_tables_name_to_repair);
 
 
 
 
607
 
608
  // Put 'u' type to all uncategorized items and count all items
609
  foreach($aDBc_all_items as $item_name => $item_info){
643
 
644
  switch($item_info['type']){
645
  case 'u' :
646
+ $belongs_to_without_html = __('Available in Pro version!', 'advanced-database-cleaner');
647
+ $belongs_to = '<span style="color:#999">' . $belongs_to_without_html . '</span>';
 
 
 
 
 
648
  break;
649
  case 'o' :
650
  $belongs_to_without_html = __('Orphan!', 'advanced-database-cleaner');
includes/header_page_filter.php CHANGED
@@ -3,20 +3,11 @@
3
 
4
  <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
5
 
6
- <?php
7
- if(ADBC_PLUGIN_F_TYPE == "free"){
8
- $aDBc_form_style = "pointer-events:none;opacity:0.5";
9
-
10
- }else{
11
- $aDBc_form_style = "";
12
- }
13
- ?>
14
-
15
  <div style="float:left;padding:8px;height:30px">
16
 
17
  <span class="aDBc_premium_tooltip">
18
 
19
- <form method="get" style="<?php echo $aDBc_form_style ?>">
20
 
21
  <?php
22
  // Generate current parameters in URL
@@ -120,9 +111,7 @@
120
 
121
  </form>
122
 
123
- <?php if(ADBC_PLUGIN_F_TYPE == "free"){ ?>
124
- <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
125
- <?php } ?>
126
 
127
  </span>
128
  </div>
3
 
4
  <div style="clear:both;margin-bottom:25px;width:100%;background:#f9f9f9" class="aDBc-float-right">
5
 
 
 
 
 
 
 
 
 
 
6
  <div style="float:left;padding:8px;height:30px">
7
 
8
  <span class="aDBc_premium_tooltip">
9
 
10
+ <form method="get" style="pointer-events:none;opacity:0.5">
11
 
12
  <?php
13
  // Generate current parameters in URL
111
 
112
  </form>
113
 
114
+ <span style="width:150px" class="aDBc_premium_tooltiptext"><?php _e('Available in Pro version!','advanced-database-cleaner') ?></span>
 
 
115
 
116
  </span>
117
  </div>
includes/overview_settings.php CHANGED
@@ -170,21 +170,14 @@ if(isset($_POST['save_settings'])){
170
  </div>
171
  </li>
172
 
173
- <?php
174
- if(ADBC_PLUGIN_F_TYPE == "free"){
175
- ?>
176
- <li>
177
- <input type="checkbox" name="aDBc_hide_premium_tab" <?php echo (!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab']) == '1' ? "checked='checked'" : ""?>/>
178
- <?php _e('Hide premium tab', 'advanced-database-cleaner'); ?>
179
- <div class="aDBc-overview-setting-desc">
180
- <?php _e('If checked, it will hide the above premium tab', 'advanced-database-cleaner'); ?>
181
- </div>
182
- </li>
183
-
184
- <?php
185
- }
186
- ?>
187
-
188
  </ul>
189
  <input name="save_settings" type="submit" class="button-primary aDBc-save-settings-button" value="<?php _e('Save settings','advanced-database-cleaner'); ?>" />
190
  </form>
170
  </div>
171
  </li>
172
 
173
+ <li>
174
+ <input type="checkbox" name="aDBc_hide_premium_tab" <?php echo (!empty($aDBc_settings['hide_premium_tab']) && $aDBc_settings['hide_premium_tab']) == '1' ? "checked='checked'" : ""?>/>
175
+ <?php _e('Hide premium tab', 'advanced-database-cleaner'); ?>
176
+ <div class="aDBc-overview-setting-desc">
177
+ <?php _e('If checked, it will hide the above premium tab', 'advanced-database-cleaner'); ?>
178
+ </div>
179
+ </li>
180
+
 
 
 
 
 
 
 
181
  </ul>
182
  <input name="save_settings" type="submit" class="button-primary aDBc-save-settings-button" value="<?php _e('Save settings','advanced-database-cleaner'); ?>" />
183
  </form>
includes/sidebar.php CHANGED
@@ -1,37 +1,26 @@
 
1
 
 
2
 
3
- <?php
4
- if(ADBC_PLUGIN_F_TYPE == "free"){
5
- ?>
6
 
7
- <div style="margin-top:10px">
8
 
9
- <div id="aDBc-upgrade">
10
 
11
- <a target="_blank" href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner">
 
 
 
 
 
 
 
 
 
12
 
13
- <img style="width:80px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/premium.svg" />
14
-
15
- <h1 style="padding-top:20px;padding-bottom:5px"><?php _e('Upgrade to Pro', 'advanced-database-cleaner'); ?></h1>
16
-
17
- <ul>
18
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Filter & search specific items', 'advanced-database-cleaner'); ?></li>
19
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned options', 'advanced-database-cleaner'); ?></li>
20
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned tables', 'advanced-database-cleaner'); ?></li>
21
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned cron tasks', 'advanced-database-cleaner'); ?></li>
22
- <li><span class="dashicons dashicons-yes"></span> <?php _e('Premium & technical support', 'advanced-database-cleaner'); ?></li>
23
- </ul>
24
-
25
-
26
- <div style="text-align:center;border-top:1px dashed #ccc;padding:10px;color:#999"><?php echo __('The price will increase soon! Buy now at lower price!', 'advanced-database-cleaner' ); ?></div>
27
-
28
- </a>
29
-
30
- </div>
31
 
32
  </div>
33
 
34
- <?php
35
- }
36
- ?>
37
-
1
+ <div style="margin-top:10px">
2
 
3
+ <div id="aDBc-upgrade">
4
 
5
+ <a target="_blank" href="https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner">
 
 
6
 
7
+ <img style="width:80px" src="<?php echo ADBC_PLUGIN_DIR_PATH; ?>/images/premium.svg" />
8
 
9
+ <h1 style="padding-top:20px;padding-bottom:5px"><?php _e('Upgrade to Pro', 'advanced-database-cleaner'); ?></h1>
10
 
11
+ <ul>
12
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Filter & search specific items', 'advanced-database-cleaner'); ?></li>
13
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned options', 'advanced-database-cleaner'); ?></li>
14
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned tables', 'advanced-database-cleaner'); ?></li>
15
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Detect orphaned cron tasks', 'advanced-database-cleaner'); ?></li>
16
+ <li><span class="dashicons dashicons-yes"></span> <?php _e('Premium & technical support', 'advanced-database-cleaner'); ?></li>
17
+ </ul>
18
+
19
+
20
+ <div style="text-align:center;border-top:1px dashed #ccc;padding:10px;color:#999"><?php echo __('The price will increase soon! Buy now at lower price!', 'advanced-database-cleaner' ); ?></div>
21
 
22
+ </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  </div>
25
 
26
+ </div>