質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,16 +22,208 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
-
242 if(! in_array($entry['name'], $_temp)){
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
```ここに言語名を入力
|
30
|
-
|
31
|
-
ソースコード
|
32
|
-
|
33
25
|
```
|
34
26
|
|
27
|
+
<?php if(! defined('SWPA_PLUGIN_PREFIX')) return;
|
28
|
+
|
29
|
+
/**
|
30
|
+
|
31
|
+
* Class SwpaPlugin
|
32
|
+
|
33
|
+
* Static class
|
34
|
+
|
35
|
+
*/
|
36
|
+
|
37
|
+
class SwpaPlugin
|
38
|
+
|
39
|
+
{
|
40
|
+
|
41
|
+
public static function createWpMenu()
|
42
|
+
|
43
|
+
{
|
44
|
+
|
45
|
+
if (current_user_can('administrator') && function_exists('add_menu_page'))
|
46
|
+
|
47
|
+
{
|
48
|
+
|
49
|
+
$reqCap = 'activate_plugins';
|
50
|
+
|
51
|
+
add_menu_page('Secure WP', 'Secure WP', $reqCap, SWPA_PLUGIN_PREFIX, array(get_class(),'pageMain'), SwpaUtil::imageUrl('logo-small.png'));
|
52
|
+
|
53
|
+
add_submenu_page(SWPA_PLUGIN_PREFIX, 'Dashboard', __('Dashboard'), $reqCap, SWPA_PLUGIN_PREFIX, array(get_class(),'pageMain'));
|
54
|
+
|
55
|
+
add_submenu_page(SWPA_PLUGIN_PREFIX, 'Database', __('Database'), $reqCap, SWPA_PLUGIN_PREFIX.'database', array(get_class(),'pageDatabase'));
|
56
|
+
|
57
|
+
add_submenu_page(SWPA_PLUGIN_PREFIX, 'Scanner', __('Scanner'), $reqCap, SWPA_PLUGIN_PREFIX.'scanner', array(get_class(),'pageScanner'));
|
58
|
+
|
59
|
+
add_submenu_page(SWPA_PLUGIN_PREFIX, 'Live traffic', __('Live traffic'), $reqCap, SWPA_PLUGIN_PREFIX.'live_traffic', array(get_class(),'pageLiveTraffic'));
|
60
|
+
|
61
|
+
add_submenu_page(SWPA_PLUGIN_PREFIX, 'Blog', __('Blog'), $reqCap, SWPA_PLUGIN_PREFIX.'blog', array(get_class(),'pageBlog'));
|
62
|
+
|
63
|
+
add_submenu_page(SWPA_PLUGIN_PREFIX, 'Settings', __('Settings'), $reqCap, SWPA_PLUGIN_PREFIX.'settings', array(get_class(),'pageSettings'));
|
64
|
+
|
65
|
+
add_submenu_page(SWPA_PLUGIN_PREFIX, 'About', __('About'), $reqCap, SWPA_PLUGIN_PREFIX.'about', array(get_class(),'pageAbout'));
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
public static function pageMain() { SwpaUtil::includePage('dashboard.php'); }
|
74
|
+
|
75
|
+
public static function pageDatabase() { SwpaUtil::includePage('database.php'); }
|
76
|
+
|
77
|
+
public static function pageScanner() { SwpaUtil::includePage('scanner.php'); }
|
78
|
+
|
79
|
+
public static function pageLiveTraffic() { SwpaUtil::includePage('live_traffic.php'); }
|
80
|
+
|
81
|
+
public static function pageBlog() { SwpaUtil::includePage('blog.php'); }
|
82
|
+
|
83
|
+
public static function pageSettings() { SwpaUtil::includePage('settings.php'); }
|
84
|
+
|
85
|
+
public static function pageAbout() { SwpaUtil::includePage('about.php'); }
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
public static function loadResources()
|
90
|
+
|
91
|
+
{
|
92
|
+
|
93
|
+
if(SwpaUtil::canLoad()){
|
94
|
+
|
95
|
+
wp_enqueue_style('wsd-styles-base', SwpaUtil::cssUrl('styles.base.css'));
|
96
|
+
|
97
|
+
wp_enqueue_style('wsd-styles-alerts', SwpaUtil::cssUrl('styles.alerts.css'));
|
98
|
+
|
99
|
+
wp_enqueue_style('wsd-styles-general', SwpaUtil::cssUrl('styles.general.css'));
|
100
|
+
|
101
|
+
wp_enqueue_style('wsd-styles-status', SwpaUtil::cssUrl('styles.status.css'));
|
102
|
+
|
103
|
+
wp_enqueue_script('wsdplugin-js-util', SwpaUtil::jsUrl('wsd-util.js'), array('jquery'));
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
/**
|
114
|
+
|
115
|
+
* Common method to add an alert to database.
|
116
|
+
|
117
|
+
* @static
|
118
|
+
|
119
|
+
* @param string $actionName The name of the action of the alert
|
120
|
+
|
121
|
+
* @param int $type Can only be one of the following: SWPA_PLUGIN_ALERT_TYPE_OVERWRITE | SWPA_PLUGIN_ALERT_TYPE_STACK. Defaults to SWPA_PLUGIN_ALERT_TYPE_OVERWRITE
|
122
|
+
|
123
|
+
* @param int $severity Can only have one of the following values: 0 1 2 3. Defaults to 0.
|
124
|
+
|
125
|
+
* @param string $title
|
126
|
+
|
127
|
+
* @param string $description
|
128
|
+
|
129
|
+
* @param string $solution
|
130
|
+
|
131
|
+
* @return bool
|
132
|
+
|
133
|
+
*/
|
134
|
+
|
135
|
+
public static function alert($actionName, $type = 0, $severity = 0, $title = '', $description = '', $solution = '') {
|
136
|
+
|
137
|
+
global $wpdb;
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
$table = self::getTableName();
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
if($type == SWPA_PLUGIN_ALERT_TYPE_STACK)
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
//#! Check the max number of stacked alerts to keep and remove the exceeding ones
|
150
|
+
|
151
|
+
$afsDate = $wpdb->get_var("SELECT alertFirstSeen FROM $table WHERE alertActionName = '$actionName' ORDER BY `alertDate`;");
|
152
|
+
|
153
|
+
if(empty($afsDate)){ $afsDate = "CURRENT_TIMESTAMP()";}
|
154
|
+
|
155
|
+
else { $afsDate = "'".$afsDate."'"; }
|
156
|
+
|
157
|
+
$result = $wpdb->get_var("SELECT COUNT(alertId) FROM $table WHERE alertActionName = '$actionName';");
|
158
|
+
|
159
|
+
if($result >= SWPA_PLUGIN_ALERT_STACK_MAX_KEEP){
|
160
|
+
|
161
|
+
// remove older entries to make room for the new ones
|
162
|
+
|
163
|
+
$query = "DELETE FROM $table ORDER BY alertDate ASC LIMIT ".($result - (SWPA_PLUGIN_ALERT_STACK_MAX_KEEP - 1));
|
164
|
+
|
165
|
+
$wpdb->query($query);
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
//Add the new entry
|
172
|
+
|
173
|
+
$query = $wpdb->prepare(
|
174
|
+
|
175
|
+
"INSERT INTO $table
|
176
|
+
|
177
|
+
(`alertType`,
|
178
|
+
|
179
|
+
`alertSeverity`,
|
180
|
+
|
181
|
+
`alertActionName`,
|
182
|
+
|
183
|
+
`alertTitle`,
|
184
|
+
|
185
|
+
`alertDescription`,
|
186
|
+
|
187
|
+
`alertSolution`,
|
188
|
+
|
189
|
+
`alertDate`,
|
190
|
+
|
191
|
+
`alertFirstSeen`)
|
192
|
+
|
193
|
+
VALUES
|
194
|
+
|
195
|
+
(%d,
|
196
|
+
|
197
|
+
%d,
|
198
|
+
|
199
|
+
'%s',
|
200
|
+
|
201
|
+
'%s',
|
202
|
+
|
203
|
+
'%s',
|
204
|
+
|
205
|
+
'%s',
|
206
|
+
|
207
|
+
CURRENT_TIMESTAMP(),
|
208
|
+
|
209
|
+
$afsDate
|
210
|
+
|
211
|
+
);"
|
212
|
+
|
213
|
+
,$type, $severity, $actionName, $title, $description, $solution);
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
elseif($type == SWPA_PLUGIN_ALERT_TYPE_OVERWRITE)
|
218
|
+
|
219
|
+
{
|
220
|
+
|
221
|
+
//#! Find the record by actionName and update fields
|
222
|
+
|
223
|
+
$result = $wpdb->get_var("SELECT alertId FROM $table WHERE
|
224
|
+
|
225
|
+
```
|
226
|
+
|
35
227
|
|
36
228
|
|
37
229
|
### 試したこと
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
|
11
|
+
Notice: Trying to access array offset on value of type int in /home/fujitaseikotsuin/www/roppongimidtown-seikotsuin.com/wp-content/plugins/secure-wordpress/res/inc/SwpaPlugin.php on line 242
|
12
12
|
|
13
13
|
|
14
14
|
|
1
補足説明です
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,13 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
+
HPが表示されなくなりデバックしたらこの表示です。
|
16
|
+
|
15
|
-
|
17
|
+
それで調べたら以下までは進みました。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
これから何をしたらいいのか?わかりません
|
16
22
|
|
17
23
|
|
18
24
|
|