PluginProbe
WebTotem Security / 2.4.31
WebTotem Security v2.4.31
3.0.2 3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 All 110 releases
← All changes | src/Common.php +38 -16 3.0.22.4.31 View file →
@@ -9,18 +9,35 @@
9 9
10 10 add_action('upgrader_process_complete', 'wt_security_upgrade_complete', 10, 2);
11 11 function wt_security_upgrade_complete($upgrader, $options)
12 12 {
13 - /**
14 - * Creating a marker file after updating the plugin.
15 - */
16 - if ($options['type'] === 'plugin' && $options['action'] === 'update' && $upgrader->result['destination_name'] == 'wt-security') {
17 - WebTotemAgentManager::generateMarkerFile();
18 - }
13 + /**
14 + * Creating a marker file after updating the plugin.
15 + */
16 + if ($options['type'] === 'plugin' && $options['action'] === 'update' && $upgrader->result['destination_name'] == 'wt-security') {
17 + WebTotemAgentManager::generateMarkerFile();
18 + }
19 +
20 + /**
21 + * Check CVE list after install or update plugin.
22 + */
23 + if ($options['type'] === 'plugin' && ($options['action'] === 'update' || $options['action'] === 'install')){
24 + WebTotem::updateCveDataByPluginName($upgrader->new_plugin_data);
25 + }
19 26 }
20 27
21 -// WAF Include.
22 -WebTotemAgentManager::wafInclude();
28 +/**
29 + * Remove CVE from list after plugin delete.
30 + */
31 +add_action( 'deleted_plugin', 'wt_security_deleted_plugin_action', 10, 2 );
32 +function wt_security_deleted_plugin_action( $plugin_file, $deleted ){
33 + if($deleted){
34 + $slug = str_replace('.php', '', basename($plugin_file));
35 + if($slug != 'wt-security'){
36 + WebTotemDB::deleteData(['slug' => $slug], 'plugins_cve_list');
37 + }
38 + }
39 +}
23 40
24 41 if (defined('WEBTOTEM')) {
25 42
26 43 /**
@@ -55,9 +72,9 @@
55 72 /** Add lostpassword filter */
56 73 add_action('lostpassword_errors', 'WebTotemInterface::wt_lost_password', 1, 2);
57 74
58 75 /** Add site or new sites if it is multisite */
59 -// add_action('wp_insert_site', 'WebTotemInterface::addNewSite');
76 + add_action('wp_insert_site', 'WebTotemInterface::addNewSite');
60 77 }
61 78
62 79 if (WebTotemOption::getPluginSettings('hide_wp_version')) {
63 80 /** Restore readme file before WP update, then after update hide readme file */
@@ -88,8 +105,9 @@
88 105
89 106 function WtotemDailyCron()
90 107 {
91 108 WebTotemOption::setOptions(['scan_init' => 1]);
109 + WebTotem::updateCveData();
92 110 }
93 111
94 112 /** Launch of the minute cron. */
95 113 if (WebTotemOption::getOption('scan_init')) {
@@ -124,16 +142,22 @@
124 142 * @return array List of sub-pages of this plugin.
125 143 */
126 144 function wtotemPages()
127 145 {
146 + if (WebTotem::isMultiSite()) {
147 + $pages['wtotem_all_sites'] = ['title' => __('All sites', 'wtotem'), 'slug' => 'wtotem'];
148 + }
149 + $slug = WebTotem::isMultiSite() ? 'wtotem_' : 'wtotem';
128 150
129 - $slug = 'wtotem';
130 -
131 151 $pages['wtotem_dashboard'] = ['title' => __('Dashboard', 'wtotem'), 'slug' => $slug];
132 152 $pages['wtotem_open_paths'] = ['title' => __('Open paths', 'wtotem'), 'slug' => $slug];
133 153 $pages['wtotem_firewall'] = ['title' => __('Firewall', 'wtotem'), 'slug' => $slug];
134 - $pages['wtotem_antivirus'] = ['title' => __('Antivirus', 'wtotem'), 'slug' => $slug];
135 - $pages['wtotem_settings'] = ['title' => __('Settings', 'wtotem'), 'slug' => $slug];
154 +
155 + if (!WebTotem::isMultiSite() or is_super_admin()) {
156 + $pages['wtotem_antivirus'] = ['title' => __('Antivirus', 'wtotem'), 'slug' => $slug];
157 + $pages['wtotem_settings'] = ['title' => __('Settings', 'wtotem'), 'slug' => $slug];
158 + }
159 + $pages['wtotem_reports'] = ['title' => __('Reports', 'wtotem'), 'slug' => $slug];
136 160 $pages['wtotem_documentation'] = ['title' => __('Documentation', 'wtotem'), 'slug' => 'wtotem'];
137 161 $pages['wtotem_wpscan'] = ['title' => __('WP scan', 'wtotem'), 'slug' => 'wtotem'];
138 162
139 163 return $pages;
@@ -147,11 +171,9 @@
147 171 */
148 172 function wtotemAddMenu()
149 173 {
150 174
151 -// $page = !WebTotemOption::isActivated() ? 'activation' : (WebTotem::isMultiSite() ? 'all_sites' : 'dashboard');
152 - $page = !WebTotemOption::isActivated() ? 'activation' : 'dashboard';
153 -
175 + $page = !WebTotemOption::isActivated() ? 'activation' : (WebTotem::isMultiSite() ? 'all_sites' : 'dashboard');
154 176
155 177 add_menu_page(
156 178 __('WebTotem', 'wtotem'),
157 179 __('WebTotem', 'wtotem'),