Changeset 2060758
- Timestamp:
- 04/01/2019 06:05:01 AM (7 years ago)
- Location:
- duplicate-page/trunk
- Files:
-
- 2 edited
-
duplicatepage.php (modified) (9 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
duplicate-page/trunk/duplicatepage.php
r2050443 r2060758 5 5 Description: Duplicate Posts, Pages and Custom Posts using single click. 6 6 Author: mndpsingh287 7 Version: 3. 37 Version: 3.4 8 8 Author URI: https://profiles.wordpress.org/mndpsingh287/ 9 9 License: GPLv2 … … 18 18 /* 19 19 * AutoLoad Hooks 20 */ 21 public function __construct() 20 */ 21 public function __construct() 22 22 { 23 23 $opt = get_option('duplicate_page_options'); … … 100 100 public function dt_duplicate_post_as_draft() 101 101 { 102 /* 103 * get Nonce value 104 */ 105 $nonce = $_REQUEST['nonce']; 106 /* 107 * get the original post id 108 */ 109 $post_id = (isset($_GET['post']) ? intval($_GET['post']) : intval($_POST['post'])); 110 111 if(wp_verify_nonce( $nonce, 'dt-duplicate-page-'.$post_id) && current_user_can('edit_posts')) { 112 // verify Nonce 102 113 global $wpdb; 103 114 $opt = get_option('duplicate_page_options'); … … 108 119 wp_die('No post to duplicate has been supplied!'); 109 120 } 110 $returnpage = ''; 111 /* 112 * get the original post id 113 */ 114 $post_id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']); 121 $returnpage = ''; 115 122 /* 116 123 * and all the original post data then … … 188 195 wp_die('Error! Post creation failed, could not find original post: '.$post_id); 189 196 } 197 } else { 198 wp_die('Security check issue, Please try again.'); 199 } 190 200 } 191 201 … … 198 208 $post_status = !empty($opt['duplicate_post_status']) ? $opt['duplicate_post_status'] : 'draft'; 199 209 if (current_user_can('edit_posts')) { 200 $actions['duplicate'] = '<a href="admin.php?action=dt_duplicate_post_as_draft&post='.$post->ID.' " title="Duplicate this as '.$post_status.'" rel="permalink">'.__('Duplicate This', 'duplicate-page').'</a>';210 $actions['duplicate'] = '<a href="admin.php?action=dt_duplicate_post_as_draft&post='.$post->ID.'&nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ).'" title="Duplicate this as '.$post_status.'" rel="permalink">'.__('Duplicate This', 'duplicate-page').'</a>'; 201 211 } 202 212 … … 214 224 $html = '<div id="major-publishing-actions">'; 215 225 $html .= '<div id="export-action">'; 216 $html .= '<a href="admin.php?action=dt_duplicate_post_as_draft&post='.$post->ID.' " title="Duplicate this as '.$post_status.'" rel="permalink">'.__('Duplicate This', 'duplicate-page').'</a>';226 $html .= '<a href="admin.php?action=dt_duplicate_post_as_draft&post='.$post->ID.'&nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ).'" title="Duplicate this as '.$post_status.'" rel="permalink">'.__('Duplicate This', 'duplicate-page').'</a>'; 217 227 $html .= '</div>'; 218 228 $html .= '</div>'; … … 258 268 jQuery(window).load(function(e){ 259 269 var dp_post_id = "<?php echo $post->ID; ?>"; 270 var dtnonce = "<?php echo wp_create_nonce( 'dt-duplicate-page-'.$post->ID );?>"; 260 271 var dp_post_title = "Duplicate this as <?php echo $post_status; ?>"; 261 272 var dp_duplicate_link = '<div class="duplicate_page_link_guten">'; 262 dp_duplicate_link += '<a href="admin.php?action=dt_duplicate_post_as_draft&post='+dp_post_id+' " title="'+dp_post_title+'">Duplicate This</a>';273 dp_duplicate_link += '<a href="admin.php?action=dt_duplicate_post_as_draft&post='+dp_post_id+'&nonce='+dtnonce+'" title="'+dp_post_title+'">Duplicate This</a>'; 263 274 dp_duplicate_link += '</div>'; 264 275 jQuery('.edit-post-post-status').append(dp_duplicate_link); … … 289 300 'id' => 'duplicate_this', 290 301 'title' => __('Duplicate This as '.$post_status.'', 'duplicate-page'), 291 'href' => admin_url().'admin.php?action=dt_duplicate_post_as_draft&post='.$post->ID ,302 'href' => admin_url().'admin.php?action=dt_duplicate_post_as_draft&post='.$post->ID.'&nonce='.wp_create_nonce( 'dt-duplicate-page-'.$post->ID ) 292 303 )); 293 304 } -
duplicate-page/trunk/readme.txt
r2050443 r2060758 4 4 Requires at least: 3.4 5 5 Tested up to: 5.1.1 6 Stable tag: 3. 36 Stable tag: 3.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 56 56 57 57 == Changelog == 58 59 = 3.4 (23rd March, 2019) = 60 61 * Security issues fixes addressed by Securi Team(https://sucuri.net/) 58 62 59 63 = 3.3 (14th March, 2019) =
Note: See TracChangeset
for help on using the changeset viewer.