Version Description
- Add display a warning about changing the login page URL, when activate the plugin
Download this release
Release Info
Developer | jp-secure |
Plugin | SiteGuard WP Plugin |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.5
- languages/siteguard-ja.mo +0 -0
- languages/siteguard-ja.po +17 -0
- readme.txt +3 -1
- really-simple-captcha/really-simple-captcha.php +0 -388
- siteguard.php +20 -2
languages/siteguard-ja.mo
CHANGED
Binary file
|
languages/siteguard-ja.po
CHANGED
@@ -42,6 +42,23 @@ msgstr "この機能を、プラグイン \""
|
|
42 |
msgid "\" cannot be used at the same time."
|
43 |
msgstr "\" と同時に使用することはできません。"
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
#: admin/siteguard-menu-admin-filter.php:42
|
46 |
#: admin/siteguard-menu-captcha.php:38
|
47 |
#: admin/siteguard-menu-disable-pingback.php:17
|
42 |
msgid "\" cannot be used at the same time."
|
43 |
msgstr "\" と同時に使用することはできません。"
|
44 |
|
45 |
+
msgid "Login page URL was changed."
|
46 |
+
msgstr ""
|
47 |
+
"ログインページURLが変更されました。"
|
48 |
+
|
49 |
+
msgid " Please bookmark "
|
50 |
+
msgstr " "
|
51 |
+
|
52 |
+
msgid "new login URL"
|
53 |
+
msgstr "新しいログインページURL"
|
54 |
+
|
55 |
+
msgid ". Setting change is "
|
56 |
+
msgstr ""
|
57 |
+
"をブックマークしてください. 設定変更は"
|
58 |
+
|
59 |
+
msgid "here"
|
60 |
+
msgstr "こちら"
|
61 |
+
|
62 |
#: admin/siteguard-menu-admin-filter.php:42
|
63 |
#: admin/siteguard-menu-captcha.php:38
|
64 |
#: admin/siteguard-menu-disable-pingback.php:17
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: -
|
|
4 |
Tags: security, waf
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.0
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -81,6 +81,8 @@ By creating the WAF exclude rule, the WAF protection function can be activated w
|
|
81 |
http://www.jp-secure.com/cont/products/siteguard_wp_plugin/faq_en.html
|
82 |
|
83 |
== Changelog ==
|
|
|
|
|
84 |
= 1.0.4 =
|
85 |
* Fix bug that fails to update .htaccess, if there is no WordPress settings in .htaccess
|
86 |
= 1.0.3 =
|
4 |
Tags: security, waf
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 1.0.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
81 |
http://www.jp-secure.com/cont/products/siteguard_wp_plugin/faq_en.html
|
82 |
|
83 |
== Changelog ==
|
84 |
+
= 1.0.5 =
|
85 |
+
* Add display a warning about changing the login page URL, when activate the plugin
|
86 |
= 1.0.4 =
|
87 |
* Fix bug that fails to update .htaccess, if there is no WordPress settings in .htaccess
|
88 |
= 1.0.3 =
|
really-simple-captcha/really-simple-captcha.php
DELETED
@@ -1,388 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
This function based on Really Simple CAPTCHA 1.8.
|
4 |
-
modify matters
|
5 |
-
* add Hiragana ( Japanese ) CAPTCHA
|
6 |
-
* add randam line
|
7 |
-
|
8 |
-
Base-Plugin Name: Really Simple CAPTCHA
|
9 |
-
Base-Plugin URI: http://contactform7.com/captcha/
|
10 |
-
Base-Description: Really Simple CAPTCHA is a CAPTCHA module intended to be called from other plugins. It is originally created for my Contact Form 7 plugin.
|
11 |
-
Base-Author: Takayuki Miyoshi
|
12 |
-
Base-Version: 1.8
|
13 |
-
Base-Author URI: http://ideasilo.wordpress.com/
|
14 |
-
*/
|
15 |
-
|
16 |
-
/* Copyright 2007-2014 Takayuki Miyoshi (email: takayukister at gmail.com)
|
17 |
-
|
18 |
-
This program is free software; you can redistribute it and/or modify
|
19 |
-
it under the terms of the GNU General Public License as published by
|
20 |
-
the Free Software Foundation; either version 2 of the License, or
|
21 |
-
(at your option) any later version.
|
22 |
-
|
23 |
-
This program is distributed in the hope that it will be useful,
|
24 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
25 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
26 |
-
GNU General Public License for more details.
|
27 |
-
|
28 |
-
You should have received a copy of the GNU General Public License
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
31 |
-
*/
|
32 |
-
|
33 |
-
define( 'REALLYSIMPLECAPTCHA_VERSION', '1.8' );
|
34 |
-
|
35 |
-
class ReallySimpleCaptcha extends SiteGuard_Base {
|
36 |
-
|
37 |
-
public function __construct() {
|
38 |
-
|
39 |
-
/* Mode of character set alphabet(en) or hiragana(jp) */
|
40 |
-
$this->lang_mode = 'jp';
|
41 |
-
|
42 |
-
/* Length of a word in an image */
|
43 |
-
$this->char_length = 4;
|
44 |
-
|
45 |
-
/* Directory temporary keeping CAPTCHA images and corresponding text files */
|
46 |
-
$this->tmp_dir = path_join( dirname( __FILE__ ), 'tmp' );
|
47 |
-
|
48 |
-
/* Array of CAPTCHA image size. Width and height */
|
49 |
-
$this->img_size = array( 72, 24 );
|
50 |
-
|
51 |
-
/* Background color of CAPTCHA image. RGB color 0-255 */
|
52 |
-
$this->bg = array( 255, 255, 255 );
|
53 |
-
|
54 |
-
/* Foreground (character) color of CAPTCHA image. RGB color 0-255 */
|
55 |
-
$this->fg = array( 0, 0, 0 );
|
56 |
-
|
57 |
-
/* Coordinates for a text in an image. I don't know the meaning. Just adjust. */
|
58 |
-
$this->base = array( 6, 18 );
|
59 |
-
|
60 |
-
/* Font size */
|
61 |
-
$this->font_size = 14;
|
62 |
-
|
63 |
-
/* Width of a character */
|
64 |
-
$this->font_char_width = 15;
|
65 |
-
|
66 |
-
/* Image type. 'png', 'gif' or 'jpeg' */
|
67 |
-
$this->img_type = 'png';
|
68 |
-
|
69 |
-
/* Mode of temporary image files */
|
70 |
-
$this->file_mode = 0444;
|
71 |
-
|
72 |
-
/* Mode of temporary answer text files */
|
73 |
-
$this->answer_file_mode = 0440;
|
74 |
-
|
75 |
-
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Generate and return a random word.
|
79 |
-
*
|
80 |
-
* @return string Random word with $chars characters x $char_length length
|
81 |
-
*/
|
82 |
-
public function generate_random_word() {
|
83 |
-
|
84 |
-
/* Characters available in images */
|
85 |
-
$chars_en = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
|
86 |
-
$chars_jp = 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよん';
|
87 |
-
|
88 |
-
$word = '';
|
89 |
-
|
90 |
-
if( $this->lang_mode == 'jp' ) {
|
91 |
-
$this->chars = $chars_jp;
|
92 |
-
} else {
|
93 |
-
$this->chars = $chars_en;
|
94 |
-
}
|
95 |
-
|
96 |
-
for ( $i = 0; $i < $this->char_length; $i++ ) {
|
97 |
-
$pos = mt_rand( 0, mb_strlen( $this->chars ) - 1 );
|
98 |
-
$char = mb_substr( $this->chars, $pos, 1 );
|
99 |
-
$word .= $char;
|
100 |
-
}
|
101 |
-
|
102 |
-
return $word;
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Generate CAPTCHA image and corresponding answer file.
|
107 |
-
*
|
108 |
-
* @param string $prefix File prefix used for both files
|
109 |
-
* @param string $word Random word generated by generate_random_word()
|
110 |
-
* @return string|bool The file name of the CAPTCHA image. Return false if temp directory is not available.
|
111 |
-
*/
|
112 |
-
public function generate_image( $prefix, $word ) {
|
113 |
-
if ( ! $this->make_tmp_dir() )
|
114 |
-
return false;
|
115 |
-
|
116 |
-
$this->cleanup();
|
117 |
-
|
118 |
-
/* Array of fonts. Randomly picked up per character */
|
119 |
-
if( $this->lang_mode == 'jp' ) {
|
120 |
-
$this->fonts = array(
|
121 |
-
dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1c-hiragana-black.ttf',
|
122 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1c-hiragana-bold.ttf',
|
123 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1c-hiragana-heavy.ttf',
|
124 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1c-hiragana-light.ttf',
|
125 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1c-hiragana-medium.ttf',
|
126 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1c-hiragana-regular.ttf',
|
127 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1c-hiragana-thin.ttf',
|
128 |
-
dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1m-hiragana-bold.ttf',
|
129 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1m-hiragana-light.ttf',
|
130 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1m-hiragana-medium.ttf',
|
131 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1m-hiragana-regular.ttf',
|
132 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1m-hiragana-thin.ttf',
|
133 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1mn-hiragana-bold.ttf',
|
134 |
-
dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1mn-hiragana-light.ttf',
|
135 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1mn-hiragana-medium.ttf',
|
136 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1mn-hiragana-regular.ttf',
|
137 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1mn-hiragana-thin.ttf',
|
138 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1p-hiragana-black.ttf',
|
139 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1p-hiragana-bold.ttf',
|
140 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1p-hiragana-heavy.ttf',
|
141 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1p-hiragana-light.ttf',
|
142 |
-
dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1p-hiragana-medium.ttf',
|
143 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1p-hiragana-regular.ttf',
|
144 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-1p-hiragana-thin.ttf',
|
145 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2c-hiragana-black.ttf',
|
146 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2c-hiragana-bold.ttf',
|
147 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2c-hiragana-heavy.ttf',
|
148 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2c-hiragana-light.ttf',
|
149 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2c-hiragana-medium.ttf',
|
150 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2c-hiragana-regular.ttf',
|
151 |
-
dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2c-hiragana-thin.ttf',
|
152 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2m-hiragana-bold.ttf',
|
153 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2m-hiragana-light.ttf',
|
154 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2m-hiragana-medium.ttf',
|
155 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2m-hiragana-regular.ttf',
|
156 |
-
dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2m-hiragana-thin.ttf',
|
157 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2p-hiragana-black.ttf',
|
158 |
-
dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2p-hiragana-bold.ttf',
|
159 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2p-hiragana-heavy.ttf',
|
160 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2p-hiragana-light.ttf',
|
161 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2p-hiragana-medium.ttf',
|
162 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2p-hiragana-regular.ttf',
|
163 |
-
//dirname( __FILE__ ) . '/mplus-TESTFLIGHT-058/mplus-2p-hiragana-thin.ttf',
|
164 |
-
);
|
165 |
-
} else {
|
166 |
-
$this->fonts = array(
|
167 |
-
dirname( __FILE__ ) . '/gentium/GenBkBasR.ttf',
|
168 |
-
dirname( __FILE__ ) . '/gentium/GenBkBasI.ttf',
|
169 |
-
dirname( __FILE__ ) . '/gentium/GenBkBasBI.ttf',
|
170 |
-
dirname( __FILE__ ) . '/gentium/GenBkBasB.ttf',
|
171 |
-
);
|
172 |
-
}
|
173 |
-
|
174 |
-
$dir = trailingslashit( $this->tmp_dir );
|
175 |
-
$filename = null;
|
176 |
-
|
177 |
-
if ( $im = imagecreatetruecolor( $this->img_size[0], $this->img_size[1] ) ) {
|
178 |
-
$bg = imagecolorallocate( $im, $this->bg[0], $this->bg[1], $this->bg[2] );
|
179 |
-
$fg = imagecolorallocate( $im, $this->fg[0], $this->fg[1], $this->fg[2] );
|
180 |
-
|
181 |
-
imagefill( $im, 0, 0, $bg );
|
182 |
-
|
183 |
-
// randam lines
|
184 |
-
for( $i = 0; $i < 5; $i++ ) {
|
185 |
-
$color = imagecolorallocate( $im, 196, 196, 196 );
|
186 |
-
imageline( $im, mt_rand( 0, $this->img_size[0] - 1 ), mt_rand( 0, $this->img_size[1] - 1 ),
|
187 |
-
mt_rand( 0, $this->img_size[0] - 1 ), mt_rand( 0, $this->img_size[1] - 1 ),
|
188 |
-
$color );
|
189 |
-
}
|
190 |
-
|
191 |
-
$x = $this->base[0] + mt_rand( -2, 2 );
|
192 |
-
|
193 |
-
for ( $i = 0; $i < mb_strlen( $word ); $i++ ) {
|
194 |
-
$font = $this->fonts[array_rand( $this->fonts )];
|
195 |
-
$font = $this->normalize_path( $font );
|
196 |
-
imagettftext( $im, $this->font_size, mt_rand( -12, 12 ), $x,
|
197 |
-
$this->base[1] + mt_rand( -2, 2 ), $fg, $font, mb_substr( $word, $i, 1 ) );
|
198 |
-
$x += $this->font_char_width;
|
199 |
-
}
|
200 |
-
|
201 |
-
switch ( $this->img_type ) {
|
202 |
-
case 'jpeg':
|
203 |
-
$filename = sanitize_file_name( $prefix . '.jpeg' );
|
204 |
-
$file = $this->normalize_path( $dir . $filename );
|
205 |
-
imagejpeg( $im, $file );
|
206 |
-
break;
|
207 |
-
case 'gif':
|
208 |
-
$filename = sanitize_file_name( $prefix . '.gif' );
|
209 |
-
$file = $this->normalize_path( $dir . $filename );
|
210 |
-
imagegif( $im, $file );
|
211 |
-
break;
|
212 |
-
case 'png':
|
213 |
-
default:
|
214 |
-
$filename = sanitize_file_name( $prefix . '.png' );
|
215 |
-
$file = $this->normalize_path( $dir . $filename );
|
216 |
-
imagepng( $im, $file );
|
217 |
-
}
|
218 |
-
|
219 |
-
imagedestroy( $im );
|
220 |
-
@chmod( $file, $this->file_mode );
|
221 |
-
}
|
222 |
-
|
223 |
-
$this->generate_answer_file( $prefix, $word );
|
224 |
-
|
225 |
-
return $filename;
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* Generate answer file corresponding to CAPTCHA image.
|
230 |
-
*
|
231 |
-
* @param string $prefix File prefix used for answer file
|
232 |
-
* @param string $word Random word generated by generate_random_word()
|
233 |
-
*/
|
234 |
-
public function generate_answer_file( $prefix, $word ) {
|
235 |
-
$dir = trailingslashit( $this->tmp_dir );
|
236 |
-
$answer_file = $dir . sanitize_file_name( $prefix . '.txt' );
|
237 |
-
$answer_file = $this->normalize_path( $answer_file );
|
238 |
-
|
239 |
-
if ( $fh = @fopen( $answer_file, 'w' ) ) {
|
240 |
-
$word = strtoupper( $word );
|
241 |
-
$salt = wp_generate_password( 64 );
|
242 |
-
$hash = hash_hmac( 'md5', $word, $salt );
|
243 |
-
|
244 |
-
$code = $salt . '|' . $hash;
|
245 |
-
|
246 |
-
fwrite( $fh, $code );
|
247 |
-
fclose( $fh );
|
248 |
-
}
|
249 |
-
|
250 |
-
@chmod( $answer_file, $this->answer_file_mode );
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Check a response against the code kept in the temporary file.
|
255 |
-
*
|
256 |
-
* @param string $prefix File prefix used for both files
|
257 |
-
* @param string $response CAPTCHA response
|
258 |
-
* @return bool Return true if the two match, otherwise return false.
|
259 |
-
*/
|
260 |
-
public function check( $prefix, $response ) {
|
261 |
-
if ( 0 == strlen( $prefix ) ) {
|
262 |
-
return false;
|
263 |
-
}
|
264 |
-
|
265 |
-
$response = str_replace( array( " ", "\t" ), '', $response );
|
266 |
-
$response = strtoupper( $response );
|
267 |
-
|
268 |
-
$dir = trailingslashit( $this->tmp_dir );
|
269 |
-
$filename = sanitize_file_name( $prefix . '.txt' );
|
270 |
-
$file = $this->normalize_path( $dir . $filename );
|
271 |
-
|
272 |
-
if ( @is_readable( $file ) && ( $code = file_get_contents( $file ) ) ) {
|
273 |
-
$code = explode( '|', $code, 2 );
|
274 |
-
|
275 |
-
$salt = $code[0];
|
276 |
-
$hash = $code[1];
|
277 |
-
if ( hash_hmac( 'md5', $response, $salt ) == $hash )
|
278 |
-
return true;
|
279 |
-
}
|
280 |
-
|
281 |
-
return false;
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Remove temporary files with given prefix.
|
286 |
-
*
|
287 |
-
* @param string $prefix File prefix
|
288 |
-
*/
|
289 |
-
public function remove( $prefix ) {
|
290 |
-
$suffixes = array( '.jpeg', '.gif', '.png', '.php', '.txt' );
|
291 |
-
|
292 |
-
foreach ( $suffixes as $suffix ) {
|
293 |
-
$dir = trailingslashit( $this->tmp_dir );
|
294 |
-
$filename = sanitize_file_name( $prefix . $suffix );
|
295 |
-
$file = $this->normalize_path( $dir . $filename );
|
296 |
-
|
297 |
-
if ( @is_file( $file ) ) {
|
298 |
-
unlink( $file );
|
299 |
-
}
|
300 |
-
}
|
301 |
-
}
|
302 |
-
|
303 |
-
/**
|
304 |
-
* Clean up dead files older than given length of time.
|
305 |
-
*
|
306 |
-
* @param int $minutes Consider older files than this time as dead files
|
307 |
-
* @return int|bool The number of removed files. Return false if error occurred.
|
308 |
-
*/
|
309 |
-
public function cleanup( $minutes = 60 ) {
|
310 |
-
$dir = trailingslashit( $this->tmp_dir );
|
311 |
-
$dir = $this->normalize_path( $dir );
|
312 |
-
|
313 |
-
if ( ! @is_dir( $dir ) || ! @is_readable( $dir ) )
|
314 |
-
return false;
|
315 |
-
|
316 |
-
$is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) );
|
317 |
-
|
318 |
-
if ( ! ( $is_win ? win_is_writable( $dir ) : @is_writable( $dir ) ) )
|
319 |
-
return false;
|
320 |
-
|
321 |
-
$count = 0;
|
322 |
-
|
323 |
-
if ( $handle = @opendir( $dir ) ) {
|
324 |
-
while ( false !== ( $filename = readdir( $handle ) ) ) {
|
325 |
-
if ( ! preg_match( '/^[0-9]+\.(php|txt|png|gif|jpeg)$/', $filename ) )
|
326 |
-
continue;
|
327 |
-
|
328 |
-
$file = $this->normalize_path( $dir . $filename );
|
329 |
-
|
330 |
-
$stat = @stat( $file );
|
331 |
-
if ( ( $stat['mtime'] + $minutes * 60 ) < time() ) {
|
332 |
-
@unlink( $file );
|
333 |
-
$count += 1;
|
334 |
-
}
|
335 |
-
}
|
336 |
-
|
337 |
-
closedir( $handle );
|
338 |
-
}
|
339 |
-
|
340 |
-
return $count;
|
341 |
-
}
|
342 |
-
|
343 |
-
/**
|
344 |
-
* Make a temporary directory and generate .htaccess file in it.
|
345 |
-
*
|
346 |
-
* @return bool True on successful create, false on failure.
|
347 |
-
*/
|
348 |
-
public function make_tmp_dir() {
|
349 |
-
$dir = trailingslashit( $this->tmp_dir );
|
350 |
-
$dir = $this->normalize_path( $dir );
|
351 |
-
|
352 |
-
if ( ! wp_mkdir_p( $dir ) )
|
353 |
-
return false;
|
354 |
-
|
355 |
-
$htaccess_file = $this->normalize_path( $dir . '.htaccess' );
|
356 |
-
|
357 |
-
if ( file_exists( $htaccess_file ) )
|
358 |
-
return true;
|
359 |
-
|
360 |
-
if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
|
361 |
-
fwrite( $handle, 'Order deny,allow' . "\n" );
|
362 |
-
fwrite( $handle, 'Deny from all' . "\n" );
|
363 |
-
fwrite( $handle, '<Files ~ "^[0-9A-Za-z]+\\.(jpeg|gif|png)$">' . "\n" );
|
364 |
-
fwrite( $handle, ' Allow from all' . "\n" );
|
365 |
-
fwrite( $handle, '</Files>' . "\n" );
|
366 |
-
fclose( $handle );
|
367 |
-
}
|
368 |
-
|
369 |
-
return true;
|
370 |
-
}
|
371 |
-
|
372 |
-
/**
|
373 |
-
* Normalize a filesystem path.
|
374 |
-
*
|
375 |
-
* This should be replaced by wp_normalize_path when the plugin's
|
376 |
-
* minimum requirement becomes WordPress 3.9 or higher.
|
377 |
-
*
|
378 |
-
* @param string $path Path to normalize.
|
379 |
-
* @return string Normalized path.
|
380 |
-
*/
|
381 |
-
private function normalize_path( $path ) {
|
382 |
-
$path = str_replace( '\\', '/', $path );
|
383 |
-
$path = preg_replace( '|/+|', '/', $path );
|
384 |
-
return $path;
|
385 |
-
}
|
386 |
-
}
|
387 |
-
|
388 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
siteguard.php
CHANGED
@@ -7,7 +7,7 @@ Author: JP-Secure
|
|
7 |
Author URI: http://www.jp-secure.com/eng/
|
8 |
Text Domain: siteguard
|
9 |
Domain Path: /languages/
|
10 |
-
Version: 1.0.
|
11 |
*/
|
12 |
|
13 |
/* Copyright 2014 JP-Secure Inc
|
@@ -30,7 +30,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
30 |
exit;
|
31 |
}
|
32 |
|
33 |
-
define( 'SITEGUARD_VERSION', '1.0.
|
34 |
|
35 |
define( 'SITEGUARD_PATH', plugin_dir_path( __FILE__ ) );
|
36 |
define( 'SITEGUARD_URL_PATH', plugin_dir_url( __FILE__ ) );
|
@@ -72,6 +72,7 @@ $captcha = new SiteGuard_CAPTCHA( );
|
|
72 |
$pingback = new SiteGuard_Disable_Pingback( );
|
73 |
$waf_exclude_rule = new SiteGuard_WAF_Exclude_Rule( );
|
74 |
|
|
|
75 |
function siteguard_activate( ) {
|
76 |
global $admin_filter, $rename_login, $login_history, $captcha, $loginlock, $pingback, $waf_exclude_rule;
|
77 |
|
@@ -88,6 +89,7 @@ register_activation_hook( __FILE__, 'siteguard_activate' );
|
|
88 |
function siteguard_deactivate( ) {
|
89 |
global $config;
|
90 |
$config->set( 'siteguard_meta_version', '0.0' );
|
|
|
91 |
$config->update( );
|
92 |
SiteGuard_RenameLogin::feature_off( );
|
93 |
SiteGuard_AdminFilter::feature_off( );
|
@@ -102,6 +104,7 @@ class SiteGuard extends SiteGuard_Base {
|
|
102 |
if ( is_admin( ) ) {
|
103 |
$this->menu_init = new SiteGuard_Menu_Init( );
|
104 |
add_action( 'admin_init', array( $this, 'upgrade' ) );
|
|
|
105 |
}
|
106 |
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
107 |
}
|
@@ -112,6 +115,21 @@ class SiteGuard extends SiteGuard_Base {
|
|
112 |
dirname( plugin_basename( __FILE__ ) ) . '/languages'
|
113 |
);
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
function upgrade( ) {
|
116 |
global $config, $rename_login;
|
117 |
$upgrade_ok = true;
|
7 |
Author URI: http://www.jp-secure.com/eng/
|
8 |
Text Domain: siteguard
|
9 |
Domain Path: /languages/
|
10 |
+
Version: 1.0.5
|
11 |
*/
|
12 |
|
13 |
/* Copyright 2014 JP-Secure Inc
|
30 |
exit;
|
31 |
}
|
32 |
|
33 |
+
define( 'SITEGUARD_VERSION', '1.0.5' );
|
34 |
|
35 |
define( 'SITEGUARD_PATH', plugin_dir_path( __FILE__ ) );
|
36 |
define( 'SITEGUARD_URL_PATH', plugin_dir_url( __FILE__ ) );
|
72 |
$pingback = new SiteGuard_Disable_Pingback( );
|
73 |
$waf_exclude_rule = new SiteGuard_WAF_Exclude_Rule( );
|
74 |
|
75 |
+
|
76 |
function siteguard_activate( ) {
|
77 |
global $admin_filter, $rename_login, $login_history, $captcha, $loginlock, $pingback, $waf_exclude_rule;
|
78 |
|
89 |
function siteguard_deactivate( ) {
|
90 |
global $config;
|
91 |
$config->set( 'siteguard_meta_version', '0.0' );
|
92 |
+
$config->set( 'show_admin_notices', '0' );
|
93 |
$config->update( );
|
94 |
SiteGuard_RenameLogin::feature_off( );
|
95 |
SiteGuard_AdminFilter::feature_off( );
|
104 |
if ( is_admin( ) ) {
|
105 |
$this->menu_init = new SiteGuard_Menu_Init( );
|
106 |
add_action( 'admin_init', array( $this, 'upgrade' ) );
|
107 |
+
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
108 |
}
|
109 |
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
110 |
}
|
115 |
dirname( plugin_basename( __FILE__ ) ) . '/languages'
|
116 |
);
|
117 |
}
|
118 |
+
function admin_notices( ) {
|
119 |
+
global $config;
|
120 |
+
if ( '1' != $config->get( 'show_admin_notices' ) ) {
|
121 |
+
echo '<div class="updated" style="background-color:#719f1d;"><p><span style="border: 4px solid #def1b8;padding: 4px 4px;color:#fff;font-weight:bold;background-color:#038bc3;">';
|
122 |
+
echo esc_html__( 'Login page URL was changed.', 'siteguard' ) . '</span>';
|
123 |
+
echo '<span style="color:#eee;">';
|
124 |
+
echo esc_html__( ' Please bookmark ', 'siteguard' ) . '<a style="color:#fff;text-decoration:underline;" href="' . esc_url( wp_login_url( ) ) . '">';
|
125 |
+
echo esc_html__( 'new login URL', 'siteguard' ) . '</a>';
|
126 |
+
echo esc_html__( '. Setting change is ', 'siteguard' ) . '<a style="color:#fff;text-decoration:underline;" href="' . esc_url( menu_page_url( 'siteguard_rename_login', false ) ) . '">';
|
127 |
+
echo esc_html__( 'here', 'siteguard' ) . '</a>';
|
128 |
+
echo '.</span></p></div>';
|
129 |
+
$config->set( 'show_admin_notices', '1' );
|
130 |
+
$config->update( );
|
131 |
+
}
|
132 |
+
}
|
133 |
function upgrade( ) {
|
134 |
global $config, $rename_login;
|
135 |
$upgrade_ok = true;
|