Quick Page/Post Redirect Plugin - Version 5.1.6

Version Description

  • Security Fix: Fixed security concern in the ppr_parse_request_new method
Download this release

Release Info

Developer anadnet
Plugin Icon 128x128 Quick Page/Post Redirect Plugin
Version 5.1.6
Comparing to
See all releases

Code changes from version 5.1.5 to 5.1.6

Files changed (2) hide show
  1. page_post_redirect_plugin.php +147 -145
  2. readme.txt +5 -2
page_post_redirect_plugin.php CHANGED
@@ -1,18 +1,18 @@
1
  <?php
2
  /*
3
  Plugin Name: Quick Page/Post Redirect Plugin
4
- Plugin URI: http://www.fischercreativemedia.com/wordpress-plugins/quick-pagepost-redirect-plugin/
5
  Description: Redirect Pages, Posts or Custom Post Types to another location quickly (for internal or external URLs). Includes individual post/page options, redirects for Custom Post types, non-existant 301 Quick Redirects (helpful for sites converted to WordPress), New Window functionality, and rel=nofollow functionality.
6
- Author: Don Fischer
7
- Author URI: http://www.fischercreativemedia.com/
8
- Donate link: http://www.fischercreativemedia.com/donations/
9
- Version: 5.1.5
10
  Text Domain: quick-pagepost-redirect-plugin
11
  Domain Path: /lang
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
 
15
- * Copyright (C) 2009-2015 Donald J. Fischer <dfischer [at] fischercreativemedia [dot] com>
16
  *
17
  * This program is free software; you can redistribute it and/or
18
  * modify it under the terms of the [GNU General Public License](http://wordpress.org/about/gpl/)
@@ -93,7 +93,7 @@ class quick_page_post_reds {
93
  $this->pprmeta_seconds = get_option( 'qppr_meta_addon_sec', get_option( 'ppr_meta-seconds', 0 ) );
94
  $this->pproverride_casesensitive= get_option( 'ppr_override-casesensitive' );
95
  $this->adminlink = admin_url('/', 'admin');
96
- $this->fcmlink = 'http://www.fischercreativemedia.com/plugins';
97
  $this->ppr_metaurl = '';
98
  $this->updatemsg = '';
99
  $this->pprshowcols = get_option( 'ppr_show-columns', '1' );
@@ -701,7 +701,7 @@ class quick_page_post_reds {
701
 
702
  function ppr_wp_feed_options( $cache, $url ){
703
  // this is only for testing cached FAQ
704
- if( $url == "http://www.fischercreativemedia.com/?feed=qppr_faqs" )
705
  $cache = '1';
706
  return $cache;
707
  }
@@ -711,10 +711,10 @@ class quick_page_post_reds {
711
  echo '
712
  <div class="wrap">
713
  <h2>' . __( 'Quick Page/Post Redirect FAQs/Help', 'quick-pagepost-redirect-plugin' ) . '</h2>
714
- <div align="left"><p>' . __( 'The FAQS are now on a feed that can be updated on the fly. If you have a question and don\'t see an answer, please send an email to <a href="mailto:plugins@fischercreativemedia.com">plugins@fischercreativemedia.com</a> and ask your question. If it is relevant to the plugin, it will be added to the FAQs feed so it will show up here. Please be sure to include the plugin you are asking a question about (Quick Page/Post Redirect Plugin) and any other information like your WordPress version and examples if the plugin is not working correctly for you. THANKS!', 'quick-pagepost-redirect-plugin' ) . '</p>
715
  <hr noshade color="#C0C0C0" size="1" />
716
  ';
717
- $rss = fetch_feed( 'http://www.fischercreativemedia.com/?feed=qppr_faqs&ver=' . $this->ppr_curr_version . '&loc=' . urlencode( $this->homelink ) );
718
  $linkfaq = array();
719
  $linkcontent = array();
720
  if (!is_wp_error( $rss ) ) :
@@ -1500,53 +1500,119 @@ class quick_page_post_reds {
1500
  }
1501
 
1502
  function ppr_parse_request_new($wp) {
1503
- global $wp, $wpdb;
1504
- $this->ppr_all_redir_array = $this->get_main_array();
1505
- $this->pprptypes_ok = get_option( 'ppr_qpprptypeok', array() );
1506
- if ( isset( $_GET['action'] ) && $_GET['action'] == 'export-quick-redirects-file' ) {
1507
- $newQPPR_Array = array();
1508
- check_admin_referer( 'export-redirects-qppr' );
1509
- $type = isset( $_GET['qppr-file-type'] ) && sanitize_text_field( $_GET['qppr-file-type'] ) == 'encoded' ? 'encoded' : 'pipe' ; // can be 'encoded' or 'pipe';
1510
- header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
1511
- header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
1512
- header( 'Cache-Control: no-store, no-cache, must-revalidate' );
1513
- header( 'Cache-Control: post-check=0, pre-check=0', false );
1514
- header( 'Pragma: no-cache' );
1515
- header( "Content-Type: application/force-download" );
1516
- header( "Content-Type: application/octet-stream" );
1517
- header( "Content-Type: application/download" );
1518
- header( "Content-Disposition: attachment; filename=qppr-quick-redirects-export-" . date('U') . ".txt;" );
1519
- $newQPPR_Array['quickppr_redirects'] = get_option( 'quickppr_redirects', array() );
1520
- $newQPPR_Array['quickppr_redirects_meta'] = get_option( 'quickppr_redirects_meta', array() );
1521
- if( $type == 'encoded' ){
1522
- die( 'QUICKPAGEPOSTREDIRECT' . base64_encode( serialize( $newQPPR_Array ) ) );
1523
- }else{
1524
- if( is_array( $newQPPR_Array ) ){
1525
- $qpprs = $newQPPR_Array['quickppr_redirects'];
1526
- $qpprm = $newQPPR_Array['quickppr_redirects_meta'];
1527
- foreach($qpprs as $key=>$val){
1528
- $nw = ( isset( $qpprm[$key]['newwindow'] ) && $qpprm[$key]['newwindow'] == '1' ) ? $qpprm[$key]['newwindow'] : '0' ;
1529
- $nf = ( isset( $qpprm[$key]['nofollow'] ) && $qpprm[$key]['nofollow'] == '1' ) ? $qpprm[$key]['nofollow'] : '0' ;
1530
- $temps = str_replace( '|', '%7C', $key ) . '|' . str_replace( '|', '%7C', $val ) . '|' . $nw . '|' . $nf;
1531
- if($temps!='|||'){
1532
- $newline[] = $temps;
 
 
1533
  }
 
 
 
1534
  }
1535
- $newfile = implode( "\r\n", $newline );
1536
- }else{
1537
- $newfile = $newtext;
1538
  }
1539
- die( $newfile );
1540
- }
1541
- exit;
1542
- } elseif( isset( $_POST['import-quick-redrects-file'] ) && isset( $_FILES['qppr_file'] ) ) {
1543
- check_admin_referer( 'import-quick-redrects-file' );
1544
- if ( $_FILES['qppr_file']['error'] > 0 ) {
1545
- wp_die( __( 'An error occured during the file upload. Please fix your server configuration and retry.', 'quick-pagepost-redirect-plugin' ) , __( 'SERVER ERROR - Could Not Load', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1546
  exit;
1547
- } else {
1548
- $config_file = file_get_contents( $_FILES['qppr_file']['tmp_name'] );
1549
- if ( substr($config_file, 0, strlen('QUICKPAGEPOSTREDIRECT')) !== 'QUICKPAGEPOSTREDIRECT' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1550
  if(strpos($config_file,'|') !== false){
1551
  $delim = '|';
1552
  }elseif(strpos($config_file,',') !== false){
@@ -1556,15 +1622,20 @@ class quick_page_post_reds {
1556
  }else{
1557
  $delim = false;
1558
  }
1559
- if($delim != false){
 
 
 
 
 
1560
  $config_file = str_replace("\r\n", "\n", $config_file);
1561
- $config_file = str_replace("\r", "\n", $config_file);
1562
- $text = explode( "\n", $config_file );
1563
  $newfile1 = array();
1564
- if( is_array( $text ) && !empty( $text ) ){
1565
- foreach( $text as $nl ){
1566
- if( $nl != '' ){
1567
- $elem = explode( $delim, $nl );
1568
  if( isset( $elem[0] ) && isset( $elem[1] ) ){
1569
  $newfile1['quickppr_redirects'][esc_url($elem[0])] = esc_url($elem[1]);
1570
  $nw = isset($elem[2]) && $elem[2] == '1' ? '1' : '0';
@@ -1573,99 +1644,30 @@ class quick_page_post_reds {
1573
  $newfile1['quickppr_redirects_meta'][$elem[0]]['nofollow'] = $nf;
1574
  }
1575
  }
1576
- }
1577
  if(is_array($newfile1) && !empty( $newfile1 )){
1578
  if( isset( $newfile1['quickppr_redirects'] ) ){
1579
- update_option( 'quickppr_redirects', $newfile1['quickppr_redirects'] );
 
 
1580
  }
1581
  if( isset( $newfile1['quickppr_redirects_meta'] ) ){
1582
- update_option( 'quickppr_redirects_meta', $newfile1['quickppr_redirects_meta'] );
 
 
1583
  }
1584
  }
1585
- }
1586
- $this->qppr_try_to_clear_cache_plugins();
1587
- wp_redirect( admin_url( 'admin.php?page=redirect-import-export&update=4' ), 302 );
1588
- exit;
1589
- }else{
1590
- wp_die( __( 'This does not look like a Quick Page Post Redirect file - it is possibly damaged or corrupt.', 'quick-pagepost-redirect-plugin' ) , __( 'ERROR - Not a valid File', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1591
- exit;
1592
  }
1593
- } else {
1594
- $config_file = unserialize(base64_decode(substr($config_file, strlen('QUICKPAGEPOSTREDIRECT'))));
1595
- if ( !is_array( $config_file ) ) {
1596
- wp_die( __( 'This does not look like a Quick Page Post Redirect file - it is possibly damaged or corrupt.', 'quick-pagepost-redirect-plugin' ) , __( 'ERROR - Not a valid File', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1597
- exit;
1598
- } else {
1599
- $newQPPRRedirects = $config_file['quickppr_redirects'];
1600
- $newQPPRMeta = $config_file['quickppr_redirects_meta'];
1601
- update_option('quickppr_redirects', $newQPPRRedirects);
1602
- update_option('quickppr_redirects_meta', $newQPPRMeta);
1603
- $this->qppr_try_to_clear_cache_plugins();
1604
- wp_redirect(admin_url('admin.php?page=redirect-import-export&update=4'),302);
1605
- }
1606
- }
1607
- }
1608
- } elseif( isset($_POST['import_redirects_add_qppr']) && isset($_FILES['qppr_file_add']) ) {
1609
- check_admin_referer( 'import_redirects_add_qppr' );
1610
- if ( $_FILES['qppr_file_add']['error'] > 0 ) {
1611
- wp_die(__( 'An error occured during the file upload. It might me that the file is too large or you do not have the premissions to write to the temporary upload directory. Please fix your server configuration and retry.', 'quick-pagepost-redirect-plugin' ) , __( 'SERVER ERROR - Could Not Load', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1612
- exit;
1613
- } else {
1614
- $config_file = file_get_contents( $_FILES['qppr_file_add']['tmp_name'] );
1615
- if(strpos($config_file,'|') !== false){
1616
- $delim = '|';
1617
- }elseif(strpos($config_file,',') !== false){
1618
- $delim = ',';
1619
- }elseif(strpos($config_file,"\t") !== false){
1620
- $delim = "\t";
1621
- }else{
1622
- $delim = false;
1623
  }
1624
- if ( strpos( $config_file, $delim ) === false ) {
1625
- wp_die( __( 'This does not look like the file is in the correct format - it is possibly damaged or corrupt.<br/>Be sure the redirects are 1 per line and the redirect and destination are seperated by a PIPE (|), COMMA (,) or a TAB.', 'quick-pagepost-redirect-plugin' ) . '<br/>Example:<br/><br/><code>redirect|destination</code>', __( 'ERROR - Not a valid File', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1626
- exit;
1627
- } else {
1628
- $tempArr = array();
1629
- $tempMArr = array();
1630
- $config_file = str_replace("\r\n", "\n", $config_file);
1631
- $config_file = str_replace("\r", "\n", $config_file);
1632
- $QR_Array = explode( "\n", $config_file );
1633
- $newfile1 = array();
1634
- if( !empty( $QR_Array ) && is_array( $QR_Array )):
1635
- foreach( $QR_Array as $qrtoadd ):
1636
- if( $qrtoadd != '' && $delim != false && strpos( $qrtoadd, $delim ) !== false ){
1637
- $elem = explode( $delim, str_replace( array( "\r", "\n" ), array( '', '' ), $qrtoadd ) );
1638
- if( isset( $elem[0] ) && isset( $elem[1] ) ){
1639
- $newfile1['quickppr_redirects'][esc_url($elem[0])] = esc_url($elem[1]);
1640
- $nw = isset($elem[2]) && $elem[2] == '1' ? '1' : '0';
1641
- $nf = isset($elem[3]) && $elem[3] == '1' ? '1' : '0';
1642
- $newfile1['quickppr_redirects_meta'][$elem[0]]['newwindow'] = $nw;
1643
- $newfile1['quickppr_redirects_meta'][$elem[0]]['nofollow'] = $nf;
1644
- }
1645
- }
1646
- endforeach;
1647
- if(is_array($newfile1) && !empty( $newfile1 )){
1648
- if( isset( $newfile1['quickppr_redirects'] ) ){
1649
- $currQRs = get_option( 'quickppr_redirects', array() );
1650
- $resultQRs = array_replace($currQRs, $newfile1['quickppr_redirects']);
1651
- update_option( 'quickppr_redirects', $resultQRs );
1652
- }
1653
- if( isset( $newfile1['quickppr_redirects_meta'] ) ){
1654
- $currQRM = get_option( 'quickppr_redirects_meta', array() );
1655
- $resultQRMs = array_replace($currQRM, $newfile1['quickppr_redirects_meta']);
1656
- update_option( 'quickppr_redirects_meta', $resultQRMs );
1657
- }
1658
- }
1659
- $this->qppr_try_to_clear_cache_plugins();
1660
- wp_redirect(admin_url('admin.php?page=redirect-import-export&update=5'),302);
1661
- exit;
1662
- else:
1663
- wp_die( __( 'It does not look like there are any valid items to import - check the file and try again.', 'quick-pagepost-redirect-plugin' ) , __( 'ERROR - No Valid items to add.', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1664
- exit;
1665
- endif;
1666
- }
1667
- }
1668
- } return;
1669
  }
1670
 
1671
  function qppr_pprhidemessage_ajax(){
1
  <?php
2
  /*
3
  Plugin Name: Quick Page/Post Redirect Plugin
4
+ Plugin URI: http://www.anadnet.com/quick-pagepost-redirect-plugin/
5
  Description: Redirect Pages, Posts or Custom Post Types to another location quickly (for internal or external URLs). Includes individual post/page options, redirects for Custom Post types, non-existant 301 Quick Redirects (helpful for sites converted to WordPress), New Window functionality, and rel=nofollow functionality.
6
+ Author: anadnet
7
+ Author URI: http://www.anadnet.com/
8
+ Donate link:
9
+ Version: 5.1.6
10
  Text Domain: quick-pagepost-redirect-plugin
11
  Domain Path: /lang
12
  License: GPLv2 or later
13
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
14
 
15
+ * Copyright (C) 2009-2015 anadnet.com <info [at] anadnet [dot] com>
16
  *
17
  * This program is free software; you can redistribute it and/or
18
  * modify it under the terms of the [GNU General Public License](http://wordpress.org/about/gpl/)
93
  $this->pprmeta_seconds = get_option( 'qppr_meta_addon_sec', get_option( 'ppr_meta-seconds', 0 ) );
94
  $this->pproverride_casesensitive= get_option( 'ppr_override-casesensitive' );
95
  $this->adminlink = admin_url('/', 'admin');
96
+ $this->fcmlink = 'http://www.anadnet.com/quick-pagepost-redirect-plugin/';
97
  $this->ppr_metaurl = '';
98
  $this->updatemsg = '';
99
  $this->pprshowcols = get_option( 'ppr_show-columns', '1' );
701
 
702
  function ppr_wp_feed_options( $cache, $url ){
703
  // this is only for testing cached FAQ
704
+ if( $url == "http://www.anadnet.com/?feed=qppr_faqs" )
705
  $cache = '1';
706
  return $cache;
707
  }
711
  echo '
712
  <div class="wrap">
713
  <h2>' . __( 'Quick Page/Post Redirect FAQs/Help', 'quick-pagepost-redirect-plugin' ) . '</h2>
714
+ <div align="left"><p>' . __( 'The FAQS are now on a feed that can be updated on the fly. If you have a question and don\'t see an answer, please send an email to <a href="mailto:info@anadnet.com">info@anadnet.com</a> and ask your question. If it is relevant to the plugin, it will be added to the FAQs feed so it will show up here. Please be sure to include the plugin you are asking a question about (Quick Page/Post Redirect Plugin) and any other information like your WordPress version and examples if the plugin is not working correctly for you. THANKS!', 'quick-pagepost-redirect-plugin' ) . '</p>
715
  <hr noshade color="#C0C0C0" size="1" />
716
  ';
717
+ $rss = fetch_feed( 'http://www.anadnet.com/?feed=qppr_faqs&ver=' . $this->ppr_curr_version . '&loc=' . urlencode( $this->homelink ) );
718
  $linkfaq = array();
719
  $linkcontent = array();
720
  if (!is_wp_error( $rss ) ) :
1500
  }
1501
 
1502
  function ppr_parse_request_new($wp) {
1503
+ if( current_user_can( 'manage_options' ) ){
1504
+ global $wp, $wpdb;
1505
+ $this->ppr_all_redir_array = $this->get_main_array();
1506
+ $this->pprptypes_ok = get_option( 'ppr_qpprptypeok', array() );
1507
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'export-quick-redirects-file' ) {
1508
+ $newQPPR_Array = array();
1509
+ check_admin_referer( 'export-redirects-qppr' );
1510
+ $type = isset( $_GET['qppr-file-type'] ) && sanitize_text_field( $_GET['qppr-file-type'] ) == 'encoded' ? 'encoded' : 'pipe' ; // can be 'encoded' or 'pipe';
1511
+ header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
1512
+ header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
1513
+ header( 'Cache-Control: no-store, no-cache, must-revalidate' );
1514
+ header( 'Cache-Control: post-check=0, pre-check=0', false );
1515
+ header( 'Pragma: no-cache' );
1516
+ header( "Content-Type: application/force-download" );
1517
+ header( "Content-Type: application/octet-stream" );
1518
+ header( "Content-Type: application/download" );
1519
+ header( "Content-Disposition: attachment; filename=qppr-quick-redirects-export-" . date('U') . ".txt;" );
1520
+ $newQPPR_Array['quickppr_redirects'] = get_option( 'quickppr_redirects', array() );
1521
+ $newQPPR_Array['quickppr_redirects_meta'] = get_option( 'quickppr_redirects_meta', array() );
1522
+ if( $type == 'encoded' ){
1523
+ die( 'QUICKPAGEPOSTREDIRECT' . base64_encode( serialize( $newQPPR_Array ) ) );
1524
+ }else{
1525
+ if( is_array( $newQPPR_Array ) ){
1526
+ $qpprs = $newQPPR_Array['quickppr_redirects'];
1527
+ $qpprm = $newQPPR_Array['quickppr_redirects_meta'];
1528
+ foreach($qpprs as $key=>$val){
1529
+ $nw = ( isset( $qpprm[$key]['newwindow'] ) && $qpprm[$key]['newwindow'] == '1' ) ? $qpprm[$key]['newwindow'] : '0' ;
1530
+ $nf = ( isset( $qpprm[$key]['nofollow'] ) && $qpprm[$key]['nofollow'] == '1' ) ? $qpprm[$key]['nofollow'] : '0' ;
1531
+ $temps = str_replace( '|', '%7C', $key ) . '|' . str_replace( '|', '%7C', $val ) . '|' . $nw . '|' . $nf;
1532
+ if($temps!='|||'){
1533
+ $newline[] = $temps;
1534
+ }
1535
  }
1536
+ $newfile = implode( "\r\n", $newline );
1537
+ }else{
1538
+ $newfile = $newtext;
1539
  }
1540
+ die( $newfile );
 
 
1541
  }
 
 
 
 
 
 
 
1542
  exit;
1543
+ } elseif( isset( $_POST['import-quick-redrects-file'] ) && isset( $_FILES['qppr_file'] ) ) {
1544
+ check_admin_referer( 'import-quick-redrects-file' );
1545
+ if ( $_FILES['qppr_file']['error'] > 0 ) {
1546
+ wp_die( __( 'An error occured during the file upload. Please fix your server configuration and retry.', 'quick-pagepost-redirect-plugin' ) , __( 'SERVER ERROR - Could Not Load', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1547
+ exit;
1548
+ } else {
1549
+ $config_file = file_get_contents( $_FILES['qppr_file']['tmp_name'] );
1550
+ if ( substr($config_file, 0, strlen('QUICKPAGEPOSTREDIRECT')) !== 'QUICKPAGEPOSTREDIRECT' ) {
1551
+ if(strpos($config_file,'|') !== false){
1552
+ $delim = '|';
1553
+ }elseif(strpos($config_file,',') !== false){
1554
+ $delim = ',';
1555
+ }elseif(strpos($config_file,"\t") !== false){
1556
+ $delim = "\t";
1557
+ }else{
1558
+ $delim = false;
1559
+ }
1560
+ if($delim != false){
1561
+ $config_file = str_replace("\r\n", "\n", $config_file);
1562
+ $config_file = str_replace("\r", "\n", $config_file);
1563
+ $text = explode( "\n", $config_file );
1564
+ $newfile1 = array();
1565
+ if( is_array( $text ) && !empty( $text ) ){
1566
+ foreach( $text as $nl ){
1567
+ if( $nl != '' ){
1568
+ $elem = explode( $delim, $nl );
1569
+ if( isset( $elem[0] ) && isset( $elem[1] ) ){
1570
+ $newfile1['quickppr_redirects'][esc_url($elem[0])] = esc_url($elem[1]);
1571
+ $nw = isset($elem[2]) && $elem[2] == '1' ? '1' : '0';
1572
+ $nf = isset($elem[3]) && $elem[3] == '1' ? '1' : '0';
1573
+ $newfile1['quickppr_redirects_meta'][$elem[0]]['newwindow'] = $nw;
1574
+ $newfile1['quickppr_redirects_meta'][$elem[0]]['nofollow'] = $nf;
1575
+ }
1576
+ }
1577
+ }
1578
+ if(is_array($newfile1) && !empty( $newfile1 )){
1579
+ if( isset( $newfile1['quickppr_redirects'] ) ){
1580
+ update_option( 'quickppr_redirects', $newfile1['quickppr_redirects'] );
1581
+ }
1582
+ if( isset( $newfile1['quickppr_redirects_meta'] ) ){
1583
+ update_option( 'quickppr_redirects_meta', $newfile1['quickppr_redirects_meta'] );
1584
+ }
1585
+ }
1586
+ }
1587
+ $this->qppr_try_to_clear_cache_plugins();
1588
+ wp_redirect( admin_url( 'admin.php?page=redirect-import-export&update=4' ), 302 );
1589
+ exit;
1590
+ }else{
1591
+ wp_die( __( 'This does not look like a Quick Page Post Redirect file - it is possibly damaged or corrupt.', 'quick-pagepost-redirect-plugin' ) , __( 'ERROR - Not a valid File', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1592
+ exit;
1593
+ }
1594
+ } else {
1595
+ $config_file = unserialize(base64_decode(substr($config_file, strlen('QUICKPAGEPOSTREDIRECT'))));
1596
+ if ( !is_array( $config_file ) ) {
1597
+ wp_die( __( 'This does not look like a Quick Page Post Redirect file - it is possibly damaged or corrupt.', 'quick-pagepost-redirect-plugin' ) , __( 'ERROR - Not a valid File', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1598
+ exit;
1599
+ } else {
1600
+ $newQPPRRedirects = $config_file['quickppr_redirects'];
1601
+ $newQPPRMeta = $config_file['quickppr_redirects_meta'];
1602
+ update_option('quickppr_redirects', $newQPPRRedirects);
1603
+ update_option('quickppr_redirects_meta', $newQPPRMeta);
1604
+ $this->qppr_try_to_clear_cache_plugins();
1605
+ wp_redirect(admin_url('admin.php?page=redirect-import-export&update=4'),302);
1606
+ }
1607
+ }
1608
+ }
1609
+ } elseif( isset($_POST['import_redirects_add_qppr']) && isset($_FILES['qppr_file_add']) ) {
1610
+ check_admin_referer( 'import_redirects_add_qppr' );
1611
+ if ( $_FILES['qppr_file_add']['error'] > 0 ) {
1612
+ wp_die(__( 'An error occured during the file upload. It might me that the file is too large or you do not have the premissions to write to the temporary upload directory. Please fix your server configuration and retry.', 'quick-pagepost-redirect-plugin' ) , __( 'SERVER ERROR - Could Not Load', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1613
+ exit;
1614
+ } else {
1615
+ $config_file = file_get_contents( $_FILES['qppr_file_add']['tmp_name'] );
1616
  if(strpos($config_file,'|') !== false){
1617
  $delim = '|';
1618
  }elseif(strpos($config_file,',') !== false){
1622
  }else{
1623
  $delim = false;
1624
  }
1625
+ if ( strpos( $config_file, $delim ) === false ) {
1626
+ wp_die( __( 'This does not look like the file is in the correct format - it is possibly damaged or corrupt.<br/>Be sure the redirects are 1 per line and the redirect and destination are seperated by a PIPE (|), COMMA (,) or a TAB.', 'quick-pagepost-redirect-plugin' ) . '<br/>Example:<br/><br/><code>redirect|destination</code>', __( 'ERROR - Not a valid File', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1627
+ exit;
1628
+ } else {
1629
+ $tempArr = array();
1630
+ $tempMArr = array();
1631
  $config_file = str_replace("\r\n", "\n", $config_file);
1632
+ $config_file = str_replace("\r", "\n", $config_file);
1633
+ $QR_Array = explode( "\n", $config_file );
1634
  $newfile1 = array();
1635
+ if( !empty( $QR_Array ) && is_array( $QR_Array )):
1636
+ foreach( $QR_Array as $qrtoadd ):
1637
+ if( $qrtoadd != '' && $delim != false && strpos( $qrtoadd, $delim ) !== false ){
1638
+ $elem = explode( $delim, str_replace( array( "\r", "\n" ), array( '', '' ), $qrtoadd ) );
1639
  if( isset( $elem[0] ) && isset( $elem[1] ) ){
1640
  $newfile1['quickppr_redirects'][esc_url($elem[0])] = esc_url($elem[1]);
1641
  $nw = isset($elem[2]) && $elem[2] == '1' ? '1' : '0';
1644
  $newfile1['quickppr_redirects_meta'][$elem[0]]['nofollow'] = $nf;
1645
  }
1646
  }
1647
+ endforeach;
1648
  if(is_array($newfile1) && !empty( $newfile1 )){
1649
  if( isset( $newfile1['quickppr_redirects'] ) ){
1650
+ $currQRs = get_option( 'quickppr_redirects', array() );
1651
+ $resultQRs = array_replace($currQRs, $newfile1['quickppr_redirects']);
1652
+ update_option( 'quickppr_redirects', $resultQRs );
1653
  }
1654
  if( isset( $newfile1['quickppr_redirects_meta'] ) ){
1655
+ $currQRM = get_option( 'quickppr_redirects_meta', array() );
1656
+ $resultQRMs = array_replace($currQRM, $newfile1['quickppr_redirects_meta']);
1657
+ update_option( 'quickppr_redirects_meta', $resultQRMs );
1658
  }
1659
  }
1660
+ $this->qppr_try_to_clear_cache_plugins();
1661
+ wp_redirect(admin_url('admin.php?page=redirect-import-export&update=5'),302);
1662
+ exit;
1663
+ else:
1664
+ wp_die( __( 'It does not look like there are any valid items to import - check the file and try again.', 'quick-pagepost-redirect-plugin' ) , __( 'ERROR - No Valid items to add.', 'quick-pagepost-redirect-plugin' ), array( 'response' => '200', 'back_link' => '1' ) );
1665
+ exit;
1666
+ endif;
1667
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1668
  }
1669
+ } return;
1670
+ } return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1671
  }
1672
 
1673
  function qppr_pprhidemessage_ajax(){
readme.txt CHANGED
@@ -6,12 +6,12 @@ Requires at least: 4.0
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Tested up to: 4.3.1
9
- Stable tag: 5.1.5
10
 
11
  Easily redirect pages/posts or custom post types to another page/post or external URL by specifying the redirect URL and type (301, 302, 307, meta).
12
 
13
  == Description ==
14
- **Current Version 5.1.5**
15
 
16
  This plugin has two redirect functionalities - **"Quick Redirects"** and **"Individual Redirects"**:
17
 
@@ -182,6 +182,9 @@ NO it isn't! Check the plugin FAQs/Help page for a more up to date list of Frequ
182
  * THIS SECTION IS JUST TO KEEP TRACK OF TODO ITEMS FOR FUTURE UPDATES.
183
  * Add New Window and No Follow to links where the URL has been rewritten. Currently if you rewrite the URL neither will work as they are referenced with the original URL, not the rewrite.
184
 
 
 
 
185
  = 5.1.5 =
186
  * **Feature Addition:** Add Canonical Redirect detection to fix potential www/non-www redirect match problems. Removed from TODO!
187
  * **Deletion:** Took out testing code that was accidentally left in the previous version.
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Tested up to: 4.3.1
9
+ Stable tag: 5.1.6
10
 
11
  Easily redirect pages/posts or custom post types to another page/post or external URL by specifying the redirect URL and type (301, 302, 307, meta).
12
 
13
  == Description ==
14
+ **Current Version 5.1.6**
15
 
16
  This plugin has two redirect functionalities - **"Quick Redirects"** and **"Individual Redirects"**:
17
 
182
  * THIS SECTION IS JUST TO KEEP TRACK OF TODO ITEMS FOR FUTURE UPDATES.
183
  * Add New Window and No Follow to links where the URL has been rewritten. Currently if you rewrite the URL neither will work as they are referenced with the original URL, not the rewrite.
184
 
185
+ = 5.1.6 =
186
+ * **Security Fix:** Fixed security concern in the ppr_parse_request_new method
187
+
188
  = 5.1.5 =
189
  * **Feature Addition:** Add Canonical Redirect detection to fix potential www/non-www redirect match problems. Removed from TODO!
190
  * **Deletion:** Took out testing code that was accidentally left in the previous version.