WebP Express - Version 0.12.2

Version Description

(released 8 mar 2019) * Fixed bug: On some nginx configurations, the newly added protection against directly calling the converter scripts were triggering also when it should not.

Download this release

Release Info

Developer rosell.dk
Plugin Icon 128x128 WebP Express
Version 0.12.2
Comparing to
See all releases

Code changes from version 0.12.1 to 0.12.2

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://ko-fi.com/rosell
4
  Tags: webp, images, performance
5
  Requires at least: 4.0
6
  Tested up to: 5.1
7
- Stable tag: 0.12.1
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -605,6 +605,10 @@ Easy enough! - [Go here!](https://ko-fi.com/rosell). Or [here](https://buymeacof
605
 
606
  == Changelog ==
607
 
 
 
 
 
608
  = 0.12.1 =
609
  *(released 7 mar 2019)*
610
  * Fixed bug: Alter HTML crashed when HTML was larger than 600kb and "image urls" where selected
@@ -739,6 +743,9 @@ For older releases, check out changelog.txt
739
 
740
  == Upgrade Notice ==
741
 
 
 
 
742
  = 0.12.1 =
743
  Fixed bug: Alter HTML crashed when HTML was larger than 600kb and "image urls" where selected
744
 
4
  Tags: webp, images, performance
5
  Requires at least: 4.0
6
  Tested up to: 5.1
7
+ Stable tag: 0.12.2
8
  Requires PHP: 5.6
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
605
 
606
  == Changelog ==
607
 
608
+ = 0.12.2 =
609
+ *(released 8 mar 2019)*
610
+ * Fixed bug: On some nginx configurations, the newly added protection against directly calling the converter scripts were triggering also when it should not.
611
+
612
  = 0.12.1 =
613
  *(released 7 mar 2019)*
614
  * Fixed bug: Alter HTML crashed when HTML was larger than 600kb and "image urls" where selected
743
 
744
  == Upgrade Notice ==
745
 
746
+ = 0.12.2 =
747
+ * Fixed bug: On some nginx configurations, the newly added protection against directly calling the converter scripts were triggering also when it should not.
748
+
749
  = 0.12.1 =
750
  Fixed bug: Alter HTML crashed when HTML was larger than 600kb and "image urls" where selected
751
 
changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 0.12.1 =
2
  *(released 7 mar 2019)*
3
  * Fixed bug: Alter HTML crashed when HTML was larger than 600kb and "image urls" where selected
1
+ = 0.12.2 =
2
+ *(released 8 mar 2019)*
3
+ * Fixed bug: On some nginx configurations, the newly added protection against directly calling the converter scripts were triggering also when it should not.
4
+
5
  = 0.12.1 =
6
  *(released 7 mar 2019)*
7
  * Fixed bug: Alter HTML crashed when HTML was larger than 600kb and "image urls" where selected
lib/options/enqueue_scripts.php CHANGED
@@ -6,7 +6,7 @@ use \WebPExpress\Paths;
6
  include_once __DIR__ . '/../classes/Config.php';
7
  use \WebPExpress\Config;
8
 
9
- $version = '0.12.1';
10
 
11
 
12
  if (!function_exists('webp_express_add_inline_script')) {
6
  include_once __DIR__ . '/../classes/Config.php';
7
  use \WebPExpress\Config;
8
 
9
+ $version = '0.12.2';
10
 
11
 
12
  if (!function_exists('webp_express_add_inline_script')) {
webp-express.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WebP Express
4
  * Plugin URI: https://github.com/rosell-dk/webp-express
5
  * Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
6
- * Version: 0.12.1
7
  * Author: Bjørn Rosell
8
  * Author URI: https://www.bitwise-it.dk
9
  * License: GPL2
3
  * Plugin Name: WebP Express
4
  * Plugin URI: https://github.com/rosell-dk/webp-express
5
  * Description: Serve autogenerated WebP images instead of jpeg/png to browsers that supports WebP. Works on anything (media library images, galleries, theme images etc).
6
+ * Version: 0.12.2
7
  * Author: Bjørn Rosell
8
  * Author URI: https://www.bitwise-it.dk
9
  * License: GPL2
wod/webp-on-demand.php CHANGED
@@ -21,11 +21,19 @@ function exitWithError($msg) {
21
  exit;
22
  }
23
 
24
- if (preg_match('#webp-on-demand.php#', $_SERVER['REQUEST_URI'])) {
25
- exitWithError('Direct access is not allowed');
26
- exit;
 
 
 
 
 
 
 
27
  }
28
 
 
29
  /**
30
  * Get environment variable set with mod_rewrite module
31
  * Return false if the environment variable isn't found
21
  exit;
22
  }
23
 
24
+ //echo $_SERVER["SERVER_SOFTWARE"]; exit;
25
+ //stripos($_SERVER["SERVER_SOFTWARE"], 'nginx') !== false
26
+
27
+ // Protect against directly accessing webp-on-demand.php
28
+ // Only protect on Apache. We know for sure that the method is not reliable on nginx. We have not tested on litespeed yet, so we dare not.
29
+ if (stripos($_SERVER["SERVER_SOFTWARE"], 'apache') !== false) {
30
+ if (strpos($_SERVER['REQUEST_URI'], 'webp-on-demand.php') !== false) {
31
+ exitWithError('It seems you are visiting this file (plugins/webp-express/wod/webp-on-demand.php) directly. We do not allow this.');
32
+ exit;
33
+ }
34
  }
35
 
36
+
37
  /**
38
  * Get environment variable set with mod_rewrite module
39
  * Return false if the environment variable isn't found
wod/webp-realizer.php CHANGED
@@ -19,9 +19,13 @@ function exitWithError($msg) {
19
  exit;
20
  }
21
 
22
- if (preg_match('#webp-realizer.php#', $_SERVER['REQUEST_URI'])) {
23
- exitWithError('Direct access is not allowed');
24
- exit;
 
 
 
 
25
  }
26
 
27
  /**
19
  exit;
20
  }
21
 
22
+ // Protect against directly accessing webp-on-demand.php
23
+ // Only protect on Apache. We know for sure that the method is not reliable on nginx. We have not tested on litespeed yet, so we dare not.
24
+ if (stripos($_SERVER["SERVER_SOFTWARE"], 'apache') !== false) {
25
+ if (strpos($_SERVER['REQUEST_URI'], 'webp-realizer.php') !== false) {
26
+ exitWithError('It seems you are visiting this file (plugins/webp-express/wod/webp-realizer.php) directly. We do not allow this.');
27
+ exit;
28
+ }
29
  }
30
 
31
  /**