Safe Redirect Manager - Version 1.7.8

Version Description

(Dec. 16, 2015) = * Fix SQL injection bug and no search terms warning

Download this release

Release Info

Developer tlovett1
Plugin Icon 128x128 Safe Redirect Manager
Version 1.7.8
Comparing to
See all releases

Code changes from version 1.7.7 to 1.7.8

Files changed (6) hide show
  1. .travis.yml +0 -20
  2. Dockunit.json +5 -12
  3. README.md +1 -1
  4. bin/install-wp-tests.sh +2 -2
  5. readme.txt +5 -2
  6. safe-redirect-manager.php +11 -4
.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- language: php
2
-
3
- php:
4
- - 5.3
5
- - 5.4
6
-
7
- env:
8
- - WP_VERSION=latest WP_MULTISITE=0
9
- - WP_VERSION=latest WP_MULTISITE=1
10
- - WP_VERSION=3.8 WP_MULTISITE=0
11
- - WP_VERSION=3.8 WP_MULTISITE=1
12
- - WP_VERSION=3.7 WP_MULTISITE=0
13
- - WP_VERSION=3.7 WP_MULTISITE=1
14
- - WP_VERSION=3.6 WP_MULTISITE=0
15
- - WP_VERSION=3.6 WP_MULTISITE=1
16
-
17
- before_script:
18
- - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
19
-
20
- script: phpunit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockunit.json CHANGED
@@ -1,20 +1,13 @@
1
  {
2
  "containers": [
3
  {
4
- "prettyName": "PHP-FPM 5.2",
5
- "image": "tlovett1/php-5.2-phpunit-3.5",
6
  "beforeScripts": [
7
- "bash bin/install-wp-tests.sh wordpress_test234234 external external 192.168.50.4 4.1"
8
- ],
9
- "testCommand": "phpunit"
10
- },
11
- {
12
- "prettyName": "PHP-FPM 5.5",
13
- "image": "tlovett1/php-fpm-phpunit-wp",
14
- "beforeScripts": [
15
- "bash bin/install-wp-tests.sh wordpress_testhey external external 192.168.50.4 4.1"
16
  ],
17
  "testCommand": "phpunit"
18
  }
19
  ]
20
- }
1
  {
2
  "containers": [
3
  {
4
+ "prettyName": "PHP-FPM 5.6",
5
+ "image": "dockunit/prebuilt-images:php-mysql-phpunit-5.6-fpm",
6
  "beforeScripts": [
7
+ "service mysql start",
8
+ "bash bin/install-wp-tests.sh wordpress_test root '' localhost 4.1"
 
 
 
 
 
 
 
9
  ],
10
  "testCommand": "phpunit"
11
  }
12
  ]
13
+ }
README.md CHANGED
@@ -1,4 +1,4 @@
1
- Safe Redirect Manager [![Build Status](https://travis-ci.org/tlovett1/Safe-Redirect-Manager.svg?branch=master)](https://travis-ci.org/tlovett1/Safe-Redirect-Manager)
2
  ==============
3
 
4
  A WordPress plugin to safely and easily manage your website's HTTP redirects.
1
+ Safe Redirect Manager [![Build Status](https://travis-ci.org/tlovett1/Safe-Redirect-Manager.svg?branch=master)](https://travis-ci.org/tlovett1/Safe-Redirect-Manager) [![Dockunit Status](https://dockunit.io/svg/tlovett1/Safe-Redirect-Manager?master)](https://dockunit.io/projects/tlovett1/Safe-Redirect-Manager#master)
2
  ==============
3
 
4
  A WordPress plugin to safely and easily manage your website's HTTP redirects.
bin/install-wp-tests.sh CHANGED
@@ -42,7 +42,7 @@ install_test_suite() {
42
  # set up testing suite
43
  mkdir -p $WP_TESTS_DIR
44
  cd $WP_TESTS_DIR
45
- svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
46
 
47
  wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php --no-check-certificate
48
  sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php
@@ -75,4 +75,4 @@ install_db() {
75
 
76
  install_wp
77
  install_test_suite
78
- install_db
42
  # set up testing suite
43
  mkdir -p $WP_TESTS_DIR
44
  cd $WP_TESTS_DIR
45
+ svn co --quiet --trust-server-cert --non-interactive https://develop.svn.wordpress.org/trunk/tests/phpunit/includes/
46
 
47
  wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php --no-check-certificate
48
  sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php
75
 
76
  install_wp
77
  install_test_suite
78
+ install_db
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: tlovett1, tollmanz, taylorde, 10up, jakemgold, danielbachhuber, VentureBeat
3
  Tags: http redirects, redirect manager, url redirection, safe http redirection, multisite redirects
4
  Requires at least: 3.1
5
- Tested up to: 4.2
6
- Stable tag: 1.7.7
7
 
8
  Safely and easily manage your website's HTTP redirects.
9
 
@@ -24,6 +24,9 @@ Extract the zip file and just drop the contents in the wp-content/plugins/ direc
24
 
25
  == Changelog ==
26
 
 
 
 
27
  = 1.7.7 (Jun. 18, 2015) =
28
  * Make default redirect status filterable
29
  * Add composer.json
2
  Contributors: tlovett1, tollmanz, taylorde, 10up, jakemgold, danielbachhuber, VentureBeat
3
  Tags: http redirects, redirect manager, url redirection, safe http redirection, multisite redirects
4
  Requires at least: 3.1
5
+ Tested up to: 4.8
6
+ Stable tag: 1.7.8
7
 
8
  Safely and easily manage your website's HTTP redirects.
9
 
24
 
25
  == Changelog ==
26
 
27
+ = 1.7.8 (Dec. 16, 2015) =
28
+ * Fix SQL injection bug and no search terms warning
29
+
30
  = 1.7.7 (Jun. 18, 2015) =
31
  * Make default redirect status filterable
32
  * Add composer.json
safe-redirect-manager.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Safe Redirect Manager
4
  Plugin URI: http://www.10up.com
5
  Description: Easily and safely manage HTTP redirects.
6
  Author: Taylor Lovett (10up)
7
- Version: 1.7.7
8
  Author URI: http://www.10up.com
9
 
10
  GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
@@ -152,18 +152,25 @@ class SRM_Safe_Redirect_Manager {
152
  if ( empty( $wp_query ) || $this->redirect_post_type != get_query_var( 'post_type' ) || ! is_search() || empty( $where ) )
153
  return $where;
154
 
 
 
 
 
 
 
155
  $exact = get_query_var( 'exact' );
156
  $n = ( ! empty( $exact ) ) ? '' : '%';
157
 
158
  $search = '';
159
  $seperator = '';
160
- $terms = $this->get_search_terms();
161
  $search .= '(';
162
 
163
  // we check the meta values against each term in the search
164
  foreach ( $terms as $term ) {
165
  $search .= $seperator;
166
- $search .= sprintf( "( ( m.meta_value LIKE '%s%s%s' AND m.meta_key = '%s') OR ( m.meta_value LIKE '%s%s%s' AND m.meta_key = '%s') )", $n, $term, $n, $this->meta_key_redirect_from, $n, $term, $n, $this->meta_key_redirect_to );
 
 
167
  $seperator = ' OR ';
168
  }
169
 
@@ -1036,7 +1043,7 @@ class SRM_Safe_Redirect_Manager {
1036
  // import
1037
  $id = $this->create_redirect( $redirect_from, $redirect_to, $status_code, $regex );
1038
  if ( is_wp_error( $id ) ) {
1039
- $doing_wp_cli && WP_CLI::error( $id );
1040
  $skipped++;
1041
  } else {
1042
  $doing_wp_cli && WP_CLI::line( "Success - Created redirect from '{$redirect_from}' to '{$redirect_to}'" );
4
  Plugin URI: http://www.10up.com
5
  Description: Easily and safely manage HTTP redirects.
6
  Author: Taylor Lovett (10up)
7
+ Version: 1.7.8
8
  Author URI: http://www.10up.com
9
 
10
  GNU General Public License, Free Software Foundation <http://creativecommons.org/licenses/GPL/2.0/>
152
  if ( empty( $wp_query ) || $this->redirect_post_type != get_query_var( 'post_type' ) || ! is_search() || empty( $where ) )
153
  return $where;
154
 
155
+ $terms = $this->get_search_terms();
156
+
157
+ if ( empty( $terms ) ) {
158
+ return $where;
159
+ }
160
+
161
  $exact = get_query_var( 'exact' );
162
  $n = ( ! empty( $exact ) ) ? '' : '%';
163
 
164
  $search = '';
165
  $seperator = '';
 
166
  $search .= '(';
167
 
168
  // we check the meta values against each term in the search
169
  foreach ( $terms as $term ) {
170
  $search .= $seperator;
171
+ // Used esc_sql instead of wpdb->prepare since wpdb->prepare wraps things in quotes
172
+ $search .= sprintf( "( ( m.meta_value LIKE '%s%s%s' AND m.meta_key = '%s') OR ( m.meta_value LIKE '%s%s%s' AND m.meta_key = '%s') )", $n, esc_sql( $term ), $n, esc_sql( $this->meta_key_redirect_from ), $n, esc_sql( $term ), $n, esc_sql( $this->meta_key_redirect_to ) );
173
+
174
  $seperator = ' OR ';
175
  }
176
 
1043
  // import
1044
  $id = $this->create_redirect( $redirect_from, $redirect_to, $status_code, $regex );
1045
  if ( is_wp_error( $id ) ) {
1046
+ $doing_wp_cli && WP_CLI::warning( $id );
1047
  $skipped++;
1048
  } else {
1049
  $doing_wp_cli && WP_CLI::line( "Success - Created redirect from '{$redirect_from}' to '{$redirect_to}'" );