Changeset 3480946
- Timestamp:
- 03/12/2026 08:44:20 AM (2 weeks ago)
- Location:
- cv-builder/trunk
- Files:
-
- 6 edited
-
assets/public/js/qr-page-link.js (modified) (3 diffs)
-
assets/public/signature/signature.js (modified) (3 diffs)
-
bwdcv-boots.php (modified) (1 diff)
-
includes/registration-form.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
wp-cv-builder.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cv-builder/trunk/assets/public/js/qr-page-link.js
r3456396 r3480946 1 2 1 document.addEventListener('DOMContentLoaded', function () { 3 2 if (typeof QRCode === 'undefined') { … … 6 5 } 7 6 8 const qrCodeCanvas = document.getElementById('qr-code-canvas'); 7 const qrCanvases = document.querySelectorAll('canvas[data-url]'); 8 if (!qrCanvases.length) return; 9 9 10 if (!qrCodeCanvas) return; 10 qrCanvases.forEach(function (qrCodeCanvas) { 11 const { 12 url, 13 qrColor = '#000000', 14 qrBgColor = '#ffffff', 15 qrWidth = '150', 16 qrMargin = '2', 17 qrCorrectionLevel = 'L' 18 } = qrCodeCanvas.dataset; 11 19 12 const { 13 url, 14 qrColor = '#000000', 15 qrBgColor = '#ffffff', 16 qrWidth = '150', 17 qrMargin = '2', 18 qrCorrectionLevel = 'L' 19 } = qrCodeCanvas.dataset; 20 if (!url) return; 20 21 21 if (url) {22 22 const qrCodeOptions = { 23 23 color: { … … 33 33 if (error) console.error('QR Code generation failed:', error); 34 34 }); 35 } 35 }); 36 36 }); -
cv-builder/trunk/assets/public/signature/signature.js
r3472543 r3480946 2 2 3 3 function showContent(tabIndex) { 4 const contents = document.querySelectorAll('.tab-content');4 const contents = document.querySelectorAll('.tab-content'); 5 5 contents.forEach((content) => content.classList.remove('active-content')); 6 6 const tabs = document.querySelectorAll('.tab'); … … 178 178 $.post( 179 179 wpSignatureCombo.ajax_url, 180 { action: 'bwdcv_save_signature', image_data: imageData }, 180 { 181 action: 'bwdcv_save_signature', 182 security: wpSignatureCombo.nonce, 183 image_data: imageData 184 }, 181 185 function (response) { 182 186 const result = JSON.parse(response); … … 235 239 } 236 240 textFontSignttre(); 237 })(jQuery);241 })(jQuery); 238 242 239 243 (function ($) { -
cv-builder/trunk/bwdcv-boots.php
r3474363 r3480946 147 147 'bwdcv-qr-page-link', 148 148 $asset_url . 'js/qr-page-link.js', 149 array( ' jquery', 'bwdcv-qr-code' ),149 array( 'bwdcv-qr-code' ), 150 150 BWDCV_VERSION, 151 151 true -
cv-builder/trunk/includes/registration-form.php
r3474363 r3480946 36 36 // Signature 37 37 add_action( 'wp_ajax_bwdcv_save_signature', [ $this, 'wp_save_signature_image' ] ); 38 add_action( 'wp_ajax_nopriv_bwdcv_save_signature', [ $this, 'wp_save_signature_image' ] );38 // add_action( 'wp_ajax_nopriv_bwdcv_save_signature', [ $this, 'wp_save_signature_image' ] ); 39 39 add_action( 'wp_enqueue_scripts', [ $this, 'wp_signature_enqueue_assets' ] ); 40 40 // Loss pass form … … 526 526 wp_enqueue_script( 'wp-signature-combo-js', plugin_dir_url( __FILE__ ) . '../assets/public/signature/signature.js', [ 'jquery' ], null, true ); 527 527 wp_enqueue_style( 'wp-signature-combo-css', plugin_dir_url( __FILE__ ) . '../assets/public/signature/signature.css' ); 528 wp_localize_script( 'wp-signature-combo-js', 'wpSignatureCombo', [ 'ajax_url' => admin_url( 'admin-ajax.php' ) ] ); 528 wp_localize_script( 'wp-signature-combo-js', 'wpSignatureCombo', [ 529 'ajax_url' => admin_url( 'admin-ajax.php' ), 530 'nonce' => wp_create_nonce( 'bwdcv_save_signature_nonce' ), 531 ] ); 529 532 } 530 533 } 531 534 532 535 public function wp_save_signature_image() { 533 if ( isset( $_POST['image_data'] ) ) { 534 $image_data = $_POST['image_data']; 535 $upload_dir = wp_upload_dir(); 536 $file_name = 'signature_' . time() . '.png'; 537 $file_path = $upload_dir['path'] . '/' . $file_name; 538 $decoded_image = base64_decode( str_replace( 'data:image/png;base64,', '', $image_data ) ); 539 file_put_contents( $file_path, $decoded_image ); 540 $attachment = [ 541 'guid' => $upload_dir['url'] . '/' . $file_name, 542 'post_mime_type' => 'image/png', 543 'post_title' => sanitize_file_name( $file_name ), 544 'post_content' => '', 545 'post_status' => 'inherit', 546 ]; 547 $attachment_id = wp_insert_attachment( $attachment, $file_path ); 548 require_once( ABSPATH . 'wp-admin/includes/image.php' ); 549 $metadata = wp_generate_attachment_metadata( $attachment_id, $file_path ); 550 wp_update_attachment_metadata( $attachment_id, $metadata ); 551 552 echo wp_json_encode( [ 'success' => true, 'image_url' => $upload_dir['url'] . '/' . $file_name ] ); 553 } 536 537 check_ajax_referer( 'bwdcv_save_signature_nonce', 'security' ); 538 539 if ( ! current_user_can( 'cv_editor' ) ) { 540 wp_send_json_error( [ 'message' => 'Unauthorized' ], 403 ); 541 return; 542 } 543 544 if ( ! isset( $_POST['image_data'] ) ) { 545 wp_send_json_error( [ 'message' => 'No image data' ], 400 ); 546 return; 547 } 548 549 $image_data = $_POST['image_data']; 550 if ( ! str_starts_with( $image_data, 'data:image/png;base64,' ) ) { 551 wp_send_json_error( [ 'message' => 'Invalid image format' ], 400 ); 552 return; 553 } 554 $base64_data = str_replace( 'data:image/png;base64,', '', $image_data ); 555 $decoded_image = base64_decode( $base64_data, true ); 556 557 if ( $decoded_image === false ) { 558 wp_send_json_error( [ 'message' => 'Invalid base64 data' ], 400 ); 559 return; 560 } 561 562 $upload_dir = wp_upload_dir(); 563 $file_name = 'signature_' . time() . '.png'; 564 $file_path = $upload_dir['path'] . '/' . $file_name; 565 file_put_contents( $file_path, $decoded_image ); 566 $attachment = [ 567 'guid' => $upload_dir['url'] . '/' . $file_name, 568 'post_mime_type' => 'image/png', 569 'post_title' => sanitize_file_name( $file_name ), 570 'post_content' => '', 571 'post_status' => 'inherit', 572 ]; 573 $attachment_id = wp_insert_attachment( $attachment, $file_path ); 574 require_once( ABSPATH . 'wp-admin/includes/image.php' ); 575 $metadata = wp_generate_attachment_metadata( $attachment_id, $file_path ); 576 wp_update_attachment_metadata( $attachment_id, $metadata ); 577 578 echo wp_json_encode( [ 'success' => true, 'image_url' => $upload_dir['url'] . '/' . $file_name ] ); 554 579 wp_die(); 555 580 } -
cv-builder/trunk/readme.txt
r3474363 r3480946 6 6 Tested up to: 6.9 7 7 Requires PHP: 7.0 8 Stable tag: 1.3. 18 Stable tag: 1.3.2 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 145 145 == Changelog == 146 146 147 = 1.3.2 = 148 * Security fix: Added capability check and nonce verification 149 147 150 = 1.3.1 = 148 151 * Fixed wp.org review issues -
cv-builder/trunk/wp-cv-builder.php
r3474363 r3480946 4 4 * Description: WP CV Builder with eye-catching style with 24+ preset design. 5 5 * Plugin URI: https://wpcvbuilder.com/ 6 * Version: 1.3. 16 * Version: 1.3.2 7 7 * Author: Best WP Developer 8 8 * Author URI: https://bestwpdeveloper.com/ … … 41 41 42 42 define( 'BWDCV_PLUGIN_NAME', plugin_basename( __DIR__ ) ); 43 define( "BWDCV_VERSION", '1.3. 1' );43 define( "BWDCV_VERSION", '1.3.2' ); 44 44 define( 'BWDCV_FILE', __FILE__ ); 45 45 define( 'BWDCV_DIR', __DIR__ );
Note: See TracChangeset
for help on using the changeset viewer.