PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / trunk
Search Atlas SEO – OTTO AI SEO Automation for WordPress vtrunk
2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 2.6.4 2.6.3 All 139 releases
← All changes | includes/class-metasync-debug-manager.php +41 -11 2.6.22trunk View file →
@@ -76,10 +76,16 @@
76 76 $log_file = WP_CONTENT_DIR . '/metasync_data/plugin_errors.log';
77 77 if (!Metasync::current_user_has_plugin_access()) {
78 78 return;
79 79 }
80 +
81 + $can_manage_debug_settings = current_user_can('manage_options');
82 + if (isset($_POST['wp_debug_nonce']) && !$can_manage_debug_settings) {
83 + return;
84 + }
80 85
81 - if (isset($_POST['wp_debug_log_enabled']) &&
86 + if ($can_manage_debug_settings &&
87 + isset($_POST['wp_debug_log_enabled']) &&
82 88 isset($_POST['wp_debug_enabled']) &&
83 89 isset($_POST['wp_debug_display_enabled']) &&
84 90 isset($_POST['wp_debug_nonce']) &&
85 91 wp_verify_nonce($_POST['wp_debug_nonce'], 'metasync_wp_debug_settings')) {
@@ -92,20 +98,30 @@
92 98 update_option('wp_debug_log_enabled', $wp_debug_log);
93 99 update_option('wp_debug_display_enabled', $wp_debug_display);
94 100
95 101 $data = new ConfigControllerMetaSync();
96 - $data->store();
97 -
102 + $saved = $data->store();
103 +
104 + if ($saved) {
105 + add_settings_error(
106 + 'metasync_messages',
107 + 'metasync_message',
108 + 'WordPress debug settings updated successfully.',
109 + 'updated'
110 + );
111 + } else {
112 + add_settings_error(
113 + 'metasync_messages',
114 + 'metasync_message',
115 + 'Debug settings were saved, but wp-config.php could not be updated: '
116 + . ($data->getConfigError() !== '' ? $data->getConfigError() : 'the file is not writable.'),
117 + 'error'
118 + );
119 + }
120 + } elseif ($can_manage_debug_settings && isset($_POST['wp_debug_nonce']) && !wp_verify_nonce($_POST['wp_debug_nonce'], 'metasync_wp_debug_settings')) {
98 121 add_settings_error(
99 122 'metasync_messages',
100 123 'metasync_message',
101 - 'WordPress debug settings updated successfully.',
102 - 'updated'
103 - );
104 - } elseif (isset($_POST['wp_debug_nonce']) && !wp_verify_nonce($_POST['wp_debug_nonce'], 'metasync_wp_debug_settings')) {
105 - add_settings_error(
106 - 'metasync_messages',
107 - 'metasync_message',
108 124 'Security verification failed. Please try again.',
109 125 'error'
110 126 );
111 127 }
@@ -280,9 +296,15 @@
280 296 }
281 297 }
282 298
283 299 if ($changed) {
284 - require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-metasync-activator.php';
300 + if (!current_user_can('manage_options')) {
301 + return;
302 + }
303 +
304 + if (!class_exists('Metasync_Activator')) {
305 + require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-metasync-activator.php';
306 + }
285 307 Metasync_Activator::sync_plugin_file_headers();
286 308 }
287 309 }
288 310
@@ -788,8 +810,12 @@
788 810 * Handle error log operations (clear).
789 811 */
790 812 public function handle_error_log_operations()
791 813 {
814 + if ((isset($_POST['clear_log']) || isset($_POST['clear_error_summary'])) && !current_user_can('manage_options')) {
815 + return;
816 + }
817 +
792 818 if (isset($_POST['clear_log'])) {
793 819 if (wp_verify_nonce($_POST['clear_log_nonce'], 'metasync_clear_log_nonce')) {
794 820 $log_file = WP_CONTENT_DIR . '/metasync_data/plugin_errors.log';
795 821
@@ -838,8 +864,12 @@
838 864 * Handle clear all settings operations.
839 865 */
840 866 public function handle_clear_all_settings()
841 867 {
868 + if (isset($_POST['clear_all_settings']) && !current_user_can('manage_options')) {
869 + return;
870 + }
871 +
842 872 if (isset($_POST['clear_all_settings'])) {
843 873 if (wp_verify_nonce($_POST['clear_all_settings_nonce'], 'metasync_clear_all_settings_nonce')) {
844 874
845 875 $metasync_options_to_clear = [