| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -// phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 3 | +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- verified on page | |
| 4 | 4 | namespace WPDataAccess\Dashboard; |
| 5 | 5 | |
| 6 | 6 | use WP_Data_Access_Admin; |
| 7 | 7 | use WPDataAccess\Data_Dictionary\WPDA_Dictionary_Lists; |
| @@ -175,10 +175,8 @@ | ||
| 175 | 175 | * @var string|null |
| 176 | 176 | */ |
| 177 | 177 | protected $message_type = null; |
| 178 | 178 | |
| 179 | - private $current_version; | |
| 180 | - | |
| 181 | 179 | private $option_legacy_tools; |
| 182 | 180 | |
| 183 | 181 | /** |
| 184 | 182 | * Constructor |
| @@ -192,9 +190,8 @@ | ||
| 192 | 190 | $this->wp_nonce_save = wp_create_nonce( static::DASHBOARD_SAVE . WPDA::get_current_user_login() ); |
| 193 | 191 | // Load Data Tables resources. |
| 194 | 192 | \WPDataAccess\Data_Tables\WPDA_Data_Tables::enqueue_styles_and_script(); |
| 195 | 193 | } |
| 196 | - $this->current_version = get_user_meta( WPDA::get_current_user_id(), 'wpda_data_explorer', true ); | |
| 197 | 194 | // Start with empty array. |
| 198 | 195 | if ( $widget_mode ) { |
| 199 | 196 | update_user_meta( WPDA::get_current_user_id(), self::USER_DASHBOARD, array() ); |
| 200 | 197 | } |
| @@ -225,11 +222,9 @@ | ||
| 225 | 222 | $this->dashboard_default(); |
| 226 | 223 | $this->dashboard_mobile(); |
| 227 | 224 | } |
| 228 | 225 | if ( isset( $_REQUEST['page'] ) ) { |
| 229 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 230 | 226 | switch ( $_REQUEST['page'] ) { |
| 231 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 232 | 227 | case 'wpda_dashboard': |
| 233 | 228 | $this->toolbar(); |
| 234 | 229 | $this->add_forms(); |
| 235 | 230 | $this->tabs(); |
| @@ -238,24 +233,12 @@ | ||
| 238 | 233 | $this->dashboard_js(); |
| 239 | 234 | break; |
| 240 | 235 | case WP_Data_Access_Admin::PAGE_MAIN: |
| 241 | 236 | if ( !isset( $_REQUEST['page_action'] ) ) { |
| 242 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 243 | - if ( !isset( $_REQUEST['table_name'] ) ) { | |
| 244 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 245 | - $this->toolbar_wpda(); | |
| 246 | - } else { | |
| 247 | - if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) { | |
| 248 | - $this->toolbar_wpda_table(); | |
| 249 | - } else { | |
| 250 | - $this->toolbar_wpda_row(); | |
| 251 | - } | |
| 252 | - } | |
| 237 | + $this->toolbar_wpda(); | |
| 253 | 238 | } elseif ( 'wpda_backup' === $_REQUEST['page_action'] && (!isset( $_REQUEST['action'] ) || 'remove' === $_REQUEST['action'] || 'update' === $_REQUEST['action'] || 'add' === $_REQUEST['action']) ) { |
| 254 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 255 | 239 | $this->toolbar_backup(); |
| 256 | 240 | } elseif ( 'wpda_import_csv' === $_REQUEST['page_action'] ) { |
| 257 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 258 | 241 | $this->toolbar_import_csv(); |
| 259 | 242 | } |
| 260 | 243 | break; |
| 261 | 244 | case WP_Data_Access_Admin::PAGE_APPS: |
| @@ -260,11 +243,8 @@ | ||
| 260 | 243 | break; |
| 261 | 244 | case WP_Data_Access_Admin::PAGE_APPS: |
| 262 | 245 | $this->toolbar_apps(); |
| 263 | 246 | break; |
| 264 | - case WP_Data_Access_Admin::PAGE_QUERY_BUILDER: | |
| 265 | - $this->toolbar_sql(); | |
| 266 | - break; | |
| 267 | 247 | case WP_Data_Access_Admin::PAGE_DESIGNER: |
| 268 | 248 | if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) { |
| 269 | 249 | $this->toolbar_designer(); |
| 270 | 250 | } |
| @@ -294,9 +274,11 @@ | ||
| 294 | 274 | ?> |
| 295 | 275 | <script> |
| 296 | 276 | jQuery(function() { |
| 297 | 277 | const iaction = "<?php |
| 278 | + // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 298 | 279 | echo esc_attr( sanitize_text_field( $_GET['page_iaction'] ) ); |
| 280 | + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 299 | 281 | ?>"; |
| 300 | 282 | switch (iaction) { |
| 301 | 283 | case "create_new_app": |
| 302 | 284 | var interval = setInterval( |
| @@ -334,13 +316,11 @@ | ||
| 334 | 316 | */ |
| 335 | 317 | protected function get_help_url() { |
| 336 | 318 | $help_url = 'https://docs.wpdataaccess.com/'; |
| 337 | 319 | if ( isset( $_REQUEST['page'] ) ) { |
| 338 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 339 | 320 | switch ( $_REQUEST['page'] ) { |
| 340 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 341 | 321 | case \WP_Data_Access_Admin::PAGE_MAIN: |
| 342 | - $help_url = 'https://docs.legacy.wpdataaccess.com/docs/data-explorer-getting-started/'; | |
| 322 | + $help_url = 'https://docs.explorer.wpdataaccess.com/'; | |
| 343 | 323 | break; |
| 344 | 324 | case \WP_Data_Access_Admin::PAGE_APPS: |
| 345 | 325 | $help_url = 'https://docs.rad.wpdataaccess.com/'; |
| 346 | 326 | break; |
| @@ -366,9 +346,8 @@ | ||
| 366 | 346 | $help_url = 'https://docs.legacy.wpdataaccess.com/docs/project-templates/'; |
| 367 | 347 | break; |
| 368 | 348 | case 'wpdataaccess': |
| 369 | 349 | $current_tab = ( isset( $_REQUEST['tab'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tab'] ) ) : 'plugin' ); |
| 370 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 371 | 350 | switch ( $current_tab ) { |
| 372 | 351 | case 'plugin': |
| 373 | 352 | $help_url = 'https://docs.settings.wpdataaccess.com/plugin.html'; |
| 374 | 353 | break; |
| @@ -397,9 +376,8 @@ | ||
| 397 | 376 | $help_url = 'https://docs.settings.wpdataaccess.com/system-info.html'; |
| 398 | 377 | break; |
| 399 | 378 | case 'legacy': |
| 400 | 379 | $vtab = ( isset( $_REQUEST['vtab'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['vtab'] ) ) : 'plugin' ); |
| 401 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 402 | 380 | switch ( $vtab ) { |
| 403 | 381 | case 'backend': |
| 404 | 382 | $help_url = 'https://docs.settings.wpdataaccess.com/legacy-tools-back-end.html'; |
| 405 | 383 | break; |
| @@ -443,17 +421,15 @@ | ||
| 443 | 421 | <div class="wpda-dashboard"> |
| 444 | 422 | <div class="wpda-dashboard-group wpda-dashboard-group-administration"> |
| 445 | 423 | <div class="icons"> |
| 446 | 424 | <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php |
| 447 | - echo admin_url( 'admin.php' ); | |
| 448 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 425 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 449 | 426 | ?>?page=wpda_navi" title="Quick links and frequently asked questions"> |
| 450 | 427 | <div class="fa-solid fa-house"></div> |
| 451 | 428 | <div class="label">Tool Guide</div> |
| 452 | 429 | </a> |
| 453 | 430 | <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php |
| 454 | - echo admin_url( 'admin.php' ); | |
| 455 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 431 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 456 | 432 | ?>?page=wpda_apps" title="Data-driven Rapid Application Development"> |
| 457 | 433 | <div class="fa-solid"> |
| 458 | 434 | <svg xmlns="http://www.w3.org/2000/svg" height="26px" width="26px" viewBox="4 4 16 16" fill="inherit"> |
| 459 | 435 | <path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/> |
| @@ -461,17 +437,15 @@ | ||
| 461 | 437 | </div> |
| 462 | 438 | <div class="label">App Builder</div> |
| 463 | 439 | </a> |
| 464 | 440 | <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php |
| 465 | - echo admin_url( 'admin.php' ); | |
| 466 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 441 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 467 | 442 | ?>?page=wpda" title="Manage local and remote data and databases"> |
| 468 | 443 | <div class="fa-solid fa-database"></div> |
| 469 | 444 | <div class="label">Explorer</div> |
| 470 | 445 | </a> |
| 471 | 446 | <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php |
| 472 | - echo admin_url( 'admin.php' ); | |
| 473 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 447 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 474 | 448 | ?>?page=wpda_query_builder" title="SQL Query Builder"> |
| 475 | 449 | <div class="fa-solid fa-code"></div> |
| 476 | 450 | <div class="label">SQL</div> |
| 477 | 451 | </a> |
| @@ -487,10 +461,9 @@ | ||
| 487 | 461 | > |
| 488 | 462 | <div class="icons"> |
| 489 | 463 | <a class="wpda-dashboard-item wpda_tooltip_icons" |
| 490 | 464 | href="<?php |
| 491 | - echo admin_url( 'admin.php' ); | |
| 492 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 465 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 493 | 466 | ?>?page=wpda_publisher" |
| 494 | 467 | title="OLD Table Builder |
| 495 | 468 | |
| 496 | 469 | Use App Builder to access the NEW Table Builder |
| @@ -505,10 +478,9 @@ | ||
| 505 | 478 | <div class="label">Tables</div> |
| 506 | 479 | </a> |
| 507 | 480 | <a class="wpda-dashboard-item wpda_tooltip_icons" |
| 508 | 481 | href="<?php |
| 509 | - echo admin_url( 'admin.php' ); | |
| 510 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 482 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 511 | 483 | ?>?page=wpda_wpdp" |
| 512 | 484 | title="OLD Form Builder |
| 513 | 485 | |
| 514 | 486 | Use App Builder to access the NEW Form Builder |
| @@ -523,10 +495,9 @@ | ||
| 523 | 495 | <div class="label">Forms</div> |
| 524 | 496 | </a> |
| 525 | 497 | <a class="wpda-dashboard-item wpda_tooltip_icons" |
| 526 | 498 | href="<?php |
| 527 | - echo admin_url( 'admin.php' ); | |
| 528 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 499 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 529 | 500 | ?>?page=wpda_templates" |
| 530 | 501 | title="OLD Form Templates |
| 531 | 502 | |
| 532 | 503 | Customize forms using templates" |
| @@ -540,10 +511,9 @@ | ||
| 540 | 511 | <div class="label">Templates</div> |
| 541 | 512 | </a> |
| 542 | 513 | <a class="wpda-dashboard-item wpda_tooltip_icons" |
| 543 | 514 | href="<?php |
| 544 | - echo admin_url( 'admin.php' ); | |
| 545 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 515 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 546 | 516 | ?>?page=wpda_designer" |
| 547 | 517 | title="Create database tables and indexes" |
| 548 | 518 | <?php |
| 549 | 519 | if ( !$this->option_legacy_tools['designer'][0] ) { |
| @@ -561,10 +531,9 @@ | ||
| 561 | 531 | </div> |
| 562 | 532 | <div class="wpda-dashboard-group wpda-dashboard-group-settings"> |
| 563 | 533 | <div class="icons"> |
| 564 | 534 | <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php |
| 565 | - echo admin_url( 'options-general.php' ); | |
| 566 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 535 | + echo esc_url( admin_url( 'options-general.php' ) ); | |
| 567 | 536 | ?>?page=wpdataaccess" title="Manage plugin user interface and behavior"> |
| 568 | 537 | <div class="fa-solid fa-cog"></div> |
| 569 | 538 | <div class="label">Settings</div> |
| 570 | 539 | </a> |
| @@ -571,10 +540,9 @@ | ||
| 571 | 540 | <?php |
| 572 | 541 | if ( wpda_freemius()->is_registered() ) { |
| 573 | 542 | ?> |
| 574 | 543 | <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php |
| 575 | - echo admin_url( 'admin.php' ); | |
| 576 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 544 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 577 | 545 | ?>?page=<?php |
| 578 | 546 | echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG ); |
| 579 | 547 | ?>-account" title="Manage your WP Data Access account"> |
| 580 | 548 | <div class="fa-solid fa-user"></div> |
| @@ -587,10 +555,9 @@ | ||
| 587 | 555 | <div class="fa-solid fa-hand-holding-usd"></div> |
| 588 | 556 | <div class="label">Pricing</div> |
| 589 | 557 | </a> |
| 590 | 558 | <a class="wpda-dashboard-item wpda_tooltip_icons" href="<?php |
| 591 | - echo admin_url( 'admin.php' ); | |
| 592 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 559 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 593 | 560 | ?>?page=<?php |
| 594 | 561 | echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG ); |
| 595 | 562 | ?>-pricing" title="Upgrade your WP Data Access account"> |
| 596 | 563 | <div class="fa-solid fa-gem"></div> |
| @@ -611,10 +578,9 @@ | ||
| 611 | 578 | </div> |
| 612 | 579 | <div class="wpda-dashboard-group wpda-dashboard-group-support"> |
| 613 | 580 | <div class="icons"> |
| 614 | 581 | <a class="wpda-dashboard-item wpda_tooltip_icons" target="_blank" href="<?php |
| 615 | - echo $this->get_help_url(); | |
| 616 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 582 | + echo esc_url( $this->get_help_url() ); | |
| 617 | 583 | ?>" title="Context sensitive help"> |
| 618 | 584 | <div class="fa-solid fa-question-circle"></div> |
| 619 | 585 | <div class="label">Docs</div> |
| 620 | 586 | </a> |
| @@ -646,22 +612,18 @@ | ||
| 646 | 612 | <div class="wpda_nav_title">WP Data Access</div> |
| 647 | 613 | </div> |
| 648 | 614 | <ul> |
| 649 | 615 | <li class="menu-item"><a href="<?php |
| 650 | - echo admin_url( 'admin.php' ); | |
| 651 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 616 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 652 | 617 | ?>?page=wpda"><i class="fas fa-database"></i> Explorer</a></li> |
| 653 | 618 | <li class="menu-item"><a href="<?php |
| 654 | - echo admin_url( 'admin.php' ); | |
| 655 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 619 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 656 | 620 | ?>?page=wpda_query_builder"><i class="fas fa-code"></i> SQL</a></li> |
| 657 | 621 | <li class="menu-item wpda-separator"><a href="<?php |
| 658 | - echo admin_url( 'admin.php' ); | |
| 659 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 622 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 660 | 623 | ?>?page=wpda_designer"><i class="fas fa-drafting-compass"></i> Designer</a></li> |
| 661 | 624 | <li class="menu-item wpda-separator"><a href="<?php |
| 662 | - echo admin_url( 'admin.php' ); | |
| 663 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 625 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 664 | 626 | ?>?page=wpda_apps"><span style="display: inline-block; width: 20px"><svg xmlns="http://www.w3.org/2000/svg" height="12px" width="12px" viewBox="4 4 16 16" fill="inherit"> |
| 665 | 627 | <path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/> |
| 666 | 628 | </svg></span> Apps</a></li> |
| 667 | 629 | <?php |
| @@ -668,31 +630,26 @@ | ||
| 668 | 630 | ?> |
| 669 | 631 | <li class="menu-item <?php |
| 670 | 632 | echo esc_attr( $premium_separator ); |
| 671 | 633 | ?>"><a href="<?php |
| 672 | - echo admin_url( 'admin.php' ); | |
| 673 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 634 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 674 | 635 | ?>?page=wpda_publisher"><i class="fas fa-address-card"></i> Tables</a></li> |
| 675 | 636 | <?php |
| 676 | 637 | ?> |
| 677 | 638 | <li class="menu-item"><a href="<?php |
| 678 | - echo admin_url( 'admin.php' ); | |
| 679 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 639 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 680 | 640 | ?>?page=wpda_wpdp"><i class="fas fa-magic"></i> Forms</a></li> |
| 681 | 641 | <li class="menu-item wpda-separator"><a href="<?php |
| 682 | - echo admin_url( 'admin.php' ); | |
| 683 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 642 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 684 | 643 | ?>?page=wpda_templates"><i class="fas fa-desktop"></i> Templates</a></li> |
| 685 | 644 | <li class="menu-item"><a href="<?php |
| 686 | - echo admin_url( 'options-general.php' ); | |
| 687 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 645 | + echo esc_url( admin_url( 'options-general.php' ) ); | |
| 688 | 646 | ?>?page=wpdataaccess"><i class="fas fa-cog"></i> Settings</a></li> |
| 689 | 647 | <?php |
| 690 | 648 | if ( wpda_freemius()->is_registered() ) { |
| 691 | 649 | ?> |
| 692 | 650 | <li class="menu-item"><a href="<?php |
| 693 | - echo admin_url( 'admin.php' ); | |
| 694 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 651 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 695 | 652 | ?>?page=<?php |
| 696 | 653 | echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG ); |
| 697 | 654 | ?>-account"><i class="fas fa-user"></i> Account</a></li> |
| 698 | 655 | <?php |
| @@ -716,10 +673,9 @@ | ||
| 716 | 673 | <?php |
| 717 | 674 | if ( $menufound ) { |
| 718 | 675 | ?> |
| 719 | 676 | <li class="menu-item wpda-separator"><a href="<?php |
| 720 | - echo admin_url( 'admin.php' ); | |
| 721 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 677 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 722 | 678 | ?>?page=<?php |
| 723 | 679 | echo esc_attr( WP_Data_Access_Admin::MAIN_PAGE_SLUG ); |
| 724 | 680 | ?>-pricing"><i class="fas fa-gem"></i> Upgrade</a></li> |
| 725 | 681 | <?php |
| @@ -917,9 +873,8 @@ | ||
| 917 | 873 | * @return void |
| 918 | 874 | */ |
| 919 | 875 | protected function toolbar_wpda() { |
| 920 | 876 | $schema_name = ( isset( $_REQUEST['wpdaschema_name'] ) ? esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) ) : '' ); |
| 921 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 922 | 877 | ?> |
| 923 | 878 | <form id="wpda_new_design" style="display: none" method="post" action="?page=<?php |
| 924 | 879 | echo esc_attr( WP_Data_Access_Admin::PAGE_DESIGNER ); |
| 925 | 880 | ?>"> |
| @@ -924,8 +879,11 @@ | ||
| 924 | 879 | echo esc_attr( WP_Data_Access_Admin::PAGE_DESIGNER ); |
| 925 | 880 | ?>"> |
| 926 | 881 | <input type="hidden" name="action" value="create_table"> |
| 927 | 882 | <input type="hidden" name="caller" value="dataexplorer"> |
| 883 | + <input type="hidden" name="_wpnonce" value="<?php | |
| 884 | + echo esc_attr( wp_create_nonce( "wpda-query-" . WPDA_Design_Table_Model::get_base_table_name() . "--" ) ); | |
| 885 | + ?>"> | |
| 928 | 886 | </form> |
| 929 | 887 | <form id="wpda_goto_backup" style="display: none" method="post" action="?page=<?php |
| 930 | 888 | echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN ); |
| 931 | 889 | ?>&page_action=wpda_backup"> |
| @@ -937,10 +895,9 @@ | ||
| 937 | 895 | <div class="wpda-nowrap"> |
| 938 | 896 | <div> |
| 939 | 897 | <div> |
| 940 | 898 | <a href="<?php |
| 941 | - echo admin_url( 'admin.php' ); | |
| 942 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 899 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 943 | 900 | ?>?page=<?php |
| 944 | 901 | echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN ); |
| 945 | 902 | ?>&page_action=wpda_global_search" |
| 946 | 903 | class="wpda-dashboard-item wpda_tooltip" |
| @@ -963,41 +920,21 @@ | ||
| 963 | 920 | </a> |
| 964 | 921 | </div> |
| 965 | 922 | </div><div> |
| 966 | 923 | <div> |
| 967 | - <?php | |
| 968 | - if ( 'new' !== $this->current_version && '' !== $this->current_version ) { | |
| 969 | - ?> | |
| 970 | - <a onclick="jQuery('#upload_file_container_multi').show();" | |
| 971 | - href="javascript:void(0)" | |
| 972 | - class="wpda-dashboard-item wpda_tooltip" | |
| 973 | - title="Import and execute SQL script files" | |
| 974 | - > | |
| 975 | - <i class="fas fa-file-code"></i> | |
| 976 | - <div> | |
| 977 | - Import SQL files | |
| 978 | - </div> | |
| 979 | - </a> | |
| 980 | - <?php | |
| 981 | - } else { | |
| 982 | - ?> | |
| 983 | - <a onClick="window.ppActionEnableImport();" | |
| 984 | - href="javascript:void(0)" | |
| 985 | - class="wpda-dashboard-item wpda_tooltip" | |
| 986 | - title="Import and execute SQL script files" | |
| 987 | - > | |
| 988 | - <i class="fas fa-file-code"></i> | |
| 989 | - <div> | |
| 990 | - Import SQL files | |
| 991 | - </div> | |
| 992 | - </a> | |
| 993 | - <?php | |
| 994 | - } | |
| 995 | - ?> | |
| 924 | + <a onClick="window.ppActionEnableImport();" | |
| 925 | + href="javascript:void(0)" | |
| 926 | + class="wpda-dashboard-item wpda_tooltip" | |
| 927 | + title="Import and execute SQL script files" | |
| 928 | + > | |
| 929 | + <i class="fas fa-file-code"></i> | |
| 930 | + <div> | |
| 931 | + Import SQL files | |
| 932 | + </div> | |
| 933 | + </a> | |
| 996 | 934 | </div><div> |
| 997 | 935 | <a href="<?php |
| 998 | - echo admin_url( 'admin.php' ); | |
| 999 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 936 | + echo esc_url( admin_url( 'admin.php' ) ); | |
| 1000 | 937 | ?>?page=<?php |
| 1001 | 938 | echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN ); |
| 1002 | 939 | ?>&page_action=wpda_import_csv" |
| 1003 | 940 | class="wpda-dashboard-item wpda_tooltip" |
| @@ -1037,75 +974,24 @@ | ||
| 1037 | 974 | </div><?php |
| 1038 | 975 | } |
| 1039 | 976 | ?> |
| 1040 | 977 | </div><div> |
| 1041 | - <?php | |
| 1042 | - if ( 'new' !== $this->current_version && '' !== $this->current_version ) { | |
| 1043 | - ?> | |
| 1044 | - <div> | |
| 1045 | - <a onclick="jQuery('#wpda_db_container').show(); jQuery('#local_database').focus();" | |
| 1046 | - href="javascript:void(0)" | |
| 1047 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1048 | - title="Add remote database or create local database" | |
| 1049 | - > | |
| 1050 | - <i id="wpda_toolbar_icon_add_database" class="fas fa-database"></i> | |
| 1051 | - <div> | |
| 1052 | - Add database | |
| 1053 | - </div> | |
| 1054 | - </a> | |
| 1055 | - </div> | |
| 1056 | - <?php | |
| 1057 | - } else { | |
| 1058 | - ?> | |
| 1059 | - <div> | |
| 1060 | - <a onclick="jQuery('#wpda_manage_databases').show(); jQuery('#local_database').focus();" | |
| 1061 | - href="javascript:void(0)" | |
| 1062 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1063 | - title="Manage remote database connections and local databases" | |
| 1064 | - > | |
| 1065 | - <i id="wpda_toolbar_icon_add_database" class="fas fa-server"></i> | |
| 1066 | - <div> | |
| 1067 | - Databases | |
| 1068 | - </div> | |
| 1069 | - </a> | |
| 1070 | - </div><?php | |
| 1071 | - } | |
| 978 | + <div> | |
| 979 | + <a onclick="jQuery('#wpda_manage_databases').show(); jQuery('#local_database').focus();" | |
| 980 | + href="javascript:void(0)" | |
| 981 | + class="wpda-dashboard-item wpda_tooltip" | |
| 982 | + title="Manage remote database connections and local databases" | |
| 983 | + > | |
| 984 | + <i id="wpda_toolbar_icon_add_database" class="fas fa-server"></i> | |
| 985 | + <div> | |
| 986 | + Databases | |
| 987 | + </div> | |
| 988 | + </a> | |
| 989 | + </div><?php | |
| 1072 | 990 | ?> |
| 1073 | - <?php | |
| 1074 | - ?> | |
| 1075 | 991 | </div> |
| 1076 | 992 | </div> |
| 1077 | - <div class="wpda-promotion" style="font-size: 16px"> | |
| 1078 | - <?php | |
| 1079 | - if ( 'new' !== $this->current_version && '' !== $this->current_version ) { | |
| 1080 | - ?> | |
| 1081 | - <a href="?page=<?php | |
| 1082 | - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN ); | |
| 1083 | - ?>&de=new" | |
| 1084 | - style="display: flex; align-items: center; gap: 5px;" | |
| 1085 | - > | |
| 1086 | - <i class="fas fa-toggle-off"></i> | |
| 1087 | - <span>Switch to new Data Explorer</span> | |
| 1088 | - </a> | |
| 1089 | - <?php | |
| 1090 | - } else { | |
| 1091 | - ?> | |
| 1092 | - <span | |
| 1093 | - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;" | |
| 1094 | - > | |
| 1095 | - <a href="?page=<?php | |
| 1096 | - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN ); | |
| 1097 | - ?>&de=old" | |
| 1098 | - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;" | |
| 1099 | - > | |
| 1100 | - <i class="fas fa-toggle-on"></i> | |
| 1101 | - <span>Switch to old Data Explorer</span> | |
| 1102 | - </a> | |
| 1103 | - </span> | |
| 1104 | - <?php | |
| 1105 | - } | |
| 1106 | - ?> | |
| 1107 | - </div> | |
| 993 | + <div></div> | |
| 1108 | 994 | <?php |
| 1109 | 995 | //$this->get_promotions('wpda'); |
| 1110 | 996 | ?> |
| 1111 | 997 | </div> |
| @@ -1112,111 +998,8 @@ | ||
| 1112 | 998 | <?php |
| 1113 | 999 | } |
| 1114 | 1000 | |
| 1115 | 1001 | /** |
| 1116 | - * Data Explorer table page toolbar | |
| 1117 | - * | |
| 1118 | - * @return void | |
| 1119 | - */ | |
| 1120 | - protected function toolbar_wpda_table() { | |
| 1121 | - ?> | |
| 1122 | - <form id="wpda_new_row" style="display: none" method="post" action="?page=<?php | |
| 1123 | - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN ); | |
| 1124 | - ?>"> | |
| 1125 | - <?php | |
| 1126 | - if ( isset( $_REQUEST['wpdaschema_name'] ) ) { | |
| 1127 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 1128 | - $schema_name = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) ); | |
| 1129 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 1130 | - echo "<input type='hidden' name='wpdaschema_name' value='{$schema_name}'>"; | |
| 1131 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1132 | - } | |
| 1133 | - ?> | |
| 1134 | - <input type="hidden" id="wpda_new_row_table_name" name="table_name" value=""> | |
| 1135 | - <input type="hidden" name="action" value="new"> | |
| 1136 | - </form> | |
| 1137 | - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none"> | |
| 1138 | - <div class="wpda-nowrap"> | |
| 1139 | - <div> | |
| 1140 | - <div> | |
| 1141 | - <a href="javascript:void(0)" | |
| 1142 | - id="wpda_toolbar_icon_add_row" | |
| 1143 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1144 | - title="Add new row to table" | |
| 1145 | - > | |
| 1146 | - <i class="fas fa-plus-circle"></i> | |
| 1147 | - <div> | |
| 1148 | - Add row | |
| 1149 | - </div> | |
| 1150 | - </a> | |
| 1151 | - </div><div> | |
| 1152 | - <a onclick="jQuery('#upload_file_container').show()" | |
| 1153 | - href="javascript:void(0)" | |
| 1154 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1155 | - title="Allows only imports into table authors" | |
| 1156 | - > | |
| 1157 | - <i class="fas fa-code"></i> | |
| 1158 | - <div> | |
| 1159 | - Import rows | |
| 1160 | - </div> | |
| 1161 | - </a> | |
| 1162 | - </div> | |
| 1163 | - </div> | |
| 1164 | - </div> | |
| 1165 | - <?php | |
| 1166 | - $this->get_promotions( 'table' ); | |
| 1167 | - ?> | |
| 1168 | - </div> | |
| 1169 | - <?php | |
| 1170 | - } | |
| 1171 | - | |
| 1172 | - /** | |
| 1173 | - * Data Explorer data entry form toolbar | |
| 1174 | - * | |
| 1175 | - * @return void | |
| 1176 | - */ | |
| 1177 | - protected function toolbar_wpda_row() { | |
| 1178 | - ?> | |
| 1179 | - <form id="wpda_new_row" style="display: none" method="post" action="?page=<?php | |
| 1180 | - echo esc_attr( WP_Data_Access_Admin::PAGE_MAIN ); | |
| 1181 | - ?>"> | |
| 1182 | - <?php | |
| 1183 | - if ( isset( $_REQUEST['wpdaschema_name'] ) ) { | |
| 1184 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 1185 | - $schema_name = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['wpdaschema_name'] ) ) ); | |
| 1186 | - // phpcs:ignore WordPress.Security.NonceVerification | |
| 1187 | - echo "<input type='hidden' name='wpdaschema_name' value='{$schema_name}'>"; | |
| 1188 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1189 | - } | |
| 1190 | - ?> | |
| 1191 | - <input type="hidden" id="wpda_new_row_table_name" name="table_name" value=""> | |
| 1192 | - <input type="hidden" name="action" value="new"> | |
| 1193 | - </form> | |
| 1194 | - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none"> | |
| 1195 | - <div class="wpda-nowrap"> | |
| 1196 | - <div> | |
| 1197 | - <div> | |
| 1198 | - <a href="javascript:void(0)" | |
| 1199 | - id="wpda_toolbar_icon_add_row" | |
| 1200 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1201 | - title="Add new row to table" | |
| 1202 | - > | |
| 1203 | - <i class="fas fa-plus-circle"></i> | |
| 1204 | - <div> | |
| 1205 | - Add row | |
| 1206 | - </div> | |
| 1207 | - </a> | |
| 1208 | - </div> | |
| 1209 | - </div> | |
| 1210 | - </div> | |
| 1211 | - <?php | |
| 1212 | - $this->get_promotions( 'row' ); | |
| 1213 | - ?> | |
| 1214 | - </div> | |
| 1215 | - <?php | |
| 1216 | - } | |
| 1217 | - | |
| 1218 | - /** | |
| 1219 | 1002 | * Data Backup toolbar |
| 1220 | 1003 | * |
| 1221 | 1004 | * @return void |
| 1222 | 1005 | */ |
| @@ -1367,109 +1150,8 @@ | ||
| 1367 | 1150 | <?php |
| 1368 | 1151 | } |
| 1369 | 1152 | |
| 1370 | 1153 | /** |
| 1371 | - * Query Builder toolbar | |
| 1372 | - * | |
| 1373 | - * @return void | |
| 1374 | - */ | |
| 1375 | - protected function toolbar_sql() { | |
| 1376 | - $current_query_builder_version = get_user_meta( WPDA::get_current_user_id(), 'wpda_query_builder_version', true ); | |
| 1377 | - ?> | |
| 1378 | - <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none"> | |
| 1379 | - <div class="wpda-nowrap"> | |
| 1380 | - <div> | |
| 1381 | - <?php | |
| 1382 | - if ( 'old' === $current_query_builder_version ) { | |
| 1383 | - ?> | |
| 1384 | - <div> | |
| 1385 | - <a href="javascript:tabNew()" | |
| 1386 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1387 | - title="Create new query" | |
| 1388 | - > | |
| 1389 | - <i class="fas fa-plus-circle"></i> | |
| 1390 | - <div> | |
| 1391 | - Create new query | |
| 1392 | - </div> | |
| 1393 | - </a> | |
| 1394 | - </div><div> | |
| 1395 | - <a href="javascript:openQuery()" | |
| 1396 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1397 | - title="Open existing query" | |
| 1398 | - > | |
| 1399 | - <i class="fas fa-folder-open"></i> | |
| 1400 | - <div> | |
| 1401 | - Open existing query | |
| 1402 | - </div> | |
| 1403 | - </a> | |
| 1404 | - </div> | |
| 1405 | - <?php | |
| 1406 | - } else { | |
| 1407 | - ?> | |
| 1408 | - <div> | |
| 1409 | - <a href="javascript:void(0)" | |
| 1410 | - onclick="ppActionOpenQueriesMenu(event)" | |
| 1411 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1412 | - title="Create new query" | |
| 1413 | - > | |
| 1414 | - <i class="fas fa-bars"></i> | |
| 1415 | - <div> | |
| 1416 | - Menu | |
| 1417 | - </div> | |
| 1418 | - </a> | |
| 1419 | - </div><div> | |
| 1420 | - <a href="javascript:void(0)" | |
| 1421 | - onclick="ppActionFullScreen()" | |
| 1422 | - class="wpda-dashboard-item wpda_tooltip" | |
| 1423 | - title="Switch to full screen mode" | |
| 1424 | - > | |
| 1425 | - <i class="fas fa-expand"></i> | |
| 1426 | - <div> | |
| 1427 | - Full Screen | |
| 1428 | - </div> | |
| 1429 | - </a> | |
| 1430 | - </div> | |
| 1431 | - <?php | |
| 1432 | - } | |
| 1433 | - ?> | |
| 1434 | - </div> | |
| 1435 | - </div> | |
| 1436 | - <div class="wpda-promotion" style="font-size: 16px"> | |
| 1437 | - <?php | |
| 1438 | - if ( 'old' !== $current_query_builder_version ) { | |
| 1439 | - ?> | |
| 1440 | - <span | |
| 1441 | - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;" | |
| 1442 | - > | |
| 1443 | - <a href="?page=<?php | |
| 1444 | - echo esc_attr( WP_Data_Access_Admin::PAGE_QUERY_BUILDER ); | |
| 1445 | - ?>&qb=old" | |
| 1446 | - style="display: flex; align-items: center; gap: 5px; white-space: nowrap;" | |
| 1447 | - > | |
| 1448 | - <i class="fas fa-toggle-on"></i> | |
| 1449 | - <span>Switch to old Query Builder</span> | |
| 1450 | - </a> | |
| 1451 | - </span> | |
| 1452 | - <?php | |
| 1453 | - } else { | |
| 1454 | - ?> | |
| 1455 | - <a href="?page=<?php | |
| 1456 | - echo esc_attr( WP_Data_Access_Admin::PAGE_QUERY_BUILDER ); | |
| 1457 | - ?>&qb=new" | |
| 1458 | - style="display: flex; align-items: center; gap: 5px;" | |
| 1459 | - > | |
| 1460 | - <i class="fas fa-toggle-off"></i> | |
| 1461 | - <span>Switch to new Query Builder</span> | |
| 1462 | - </a> | |
| 1463 | - <?php | |
| 1464 | - } | |
| 1465 | - ?> | |
| 1466 | - </div> | |
| 1467 | - </div> | |
| 1468 | - <?php | |
| 1469 | - } | |
| 1470 | - | |
| 1471 | - /** | |
| 1472 | 1154 | * Data Designer toolbar |
| 1473 | 1155 | * |
| 1474 | 1156 | * @return void |
| 1475 | 1157 | */ |
| @@ -1481,8 +1163,11 @@ | ||
| 1481 | 1163 | <input type="hidden" name="action" value="edit"> |
| 1482 | 1164 | <input type="hidden" name="table_name" value="<?php |
| 1483 | 1165 | echo esc_attr( WPDA_Design_Table_Model::get_base_table_name() ); |
| 1484 | 1166 | ?>"> |
| 1167 | + <input type="hidden" name="_wpnonce" value="<?php | |
| 1168 | + echo esc_attr( wp_create_nonce( "wpda-query-" . WPDA_Design_Table_Model::get_base_table_name() . "--" ) ); | |
| 1169 | + ?>"> | |
| 1485 | 1170 | </form> |
| 1486 | 1171 | <div id="wpda-dashboard-toolbar" class="wpda-dashboard-toolbar" style="display:none"> |
| 1487 | 1172 | <div class="wpda-nowrap"> |
| 1488 | 1173 | <div> |
| @@ -1496,9 +1181,9 @@ | ||
| 1496 | 1181 | Create table design |
| 1497 | 1182 | </div> |
| 1498 | 1183 | </a> |
| 1499 | 1184 | </div><div> |
| 1500 | - <a onclick="jQuery('#upload_file_container').show()" | |
| 1185 | + <a onclick="alert('This feature has been removed. Please use the Data Explorer import feature.')" | |
| 1501 | 1186 | href="javascript:void(0)" |
| 1502 | 1187 | class="wpda-dashboard-item wpda_tooltip" |
| 1503 | 1188 | title="Import table designs" |
| 1504 | 1189 | > |
| @@ -1544,9 +1229,9 @@ | ||
| 1544 | 1229 | Create data table |
| 1545 | 1230 | </div> |
| 1546 | 1231 | </a> |
| 1547 | 1232 | </div><div> |
| 1548 | - <a onclick="jQuery('#upload_file_container').show()" | |
| 1233 | + <a onclick="alert('This feature has been removed. Please use the Data Explorer import feature.')" | |
| 1549 | 1234 | href="javascript:void(0)" |
| 1550 | 1235 | class="wpda-dashboard-item wpda_tooltip" |
| 1551 | 1236 | title="Import data tables" |
| 1552 | 1237 | > |
| @@ -1603,9 +1288,9 @@ | ||
| 1603 | 1288 | Create project |
| 1604 | 1289 | </div> |
| 1605 | 1290 | </a> |
| 1606 | 1291 | </div><div> |
| 1607 | - <a onclick="jQuery('#upload_file_container_multi').show()" | |
| 1292 | + <a onclick="jQuery(alert('This feature has been removed. Please use the Data Explorer import feature.')).show()" | |
| 1608 | 1293 | href="javascript:void(0)" |
| 1609 | 1294 | class="wpda-dashboard-item wpda_tooltip" |
| 1610 | 1295 | title="Import projects" |
| 1611 | 1296 | > |
| @@ -1809,9 +1494,9 @@ | ||
| 1809 | 1494 | )</option> |
| 1810 | 1495 | <?php |
| 1811 | 1496 | $rdbs = WPDADB::get_remote_databases(); |
| 1812 | 1497 | ksort( $rdbs ); |
| 1813 | - //phpcs:ignore - 8.1 proof | |
| 1498 | + // phpcs:ignore -- 8.1 proof | |
| 1814 | 1499 | foreach ( $rdbs as $key => $rdb ) { |
| 1815 | 1500 | ?> |
| 1816 | 1501 | <option value="<?php |
| 1817 | 1502 | echo esc_attr( $key ); |
| @@ -1993,9 +1678,9 @@ | ||
| 1993 | 1678 | // Following line requires PHP 7. |
| 1994 | 1679 | // $last_key = array_key_last($this->dashboard_positions[0]); . |
| 1995 | 1680 | $last_key = 1; |
| 1996 | 1681 | if ( is_array( $this->dashboard_positions ) && count( $this->dashboard_positions ) > 0 ) { |
| 1997 | - //phpcs:ignore - 8.1 proof | |
| 1682 | + // phpcs:ignore -- 8.1 proof | |
| 1998 | 1683 | foreach ( $this->dashboard_positions[0] as $key => $val ) { |
| 1999 | 1684 | $last_key = $key; |
| 2000 | 1685 | } |
| 2001 | 1686 | } |
| @@ -2086,14 +1771,14 @@ | ||
| 2086 | 1771 | let wpda_wpnonce_refresh = "<?php |
| 2087 | 1772 | echo esc_attr( wp_create_nonce( WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ); |
| 2088 | 1773 | ?>"; |
| 2089 | 1774 | let wpda_ajaxurl = "<?php |
| 2090 | - echo admin_url( 'admin-ajax.php' ); | |
| 2091 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1775 | + echo esc_url( admin_url( 'admin-ajax.php' ) ); | |
| 2092 | 1776 | ?>"; |
| 2093 | 1777 | let wpda_databases = '<?php |
| 1778 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 2094 | 1779 | echo $this->get_databases(); |
| 2095 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1780 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 2096 | 1781 | ?>'; |
| 2097 | 1782 | let wpda_shared_dashboards = <?php |
| 2098 | 1783 | echo json_encode( $this->shared_dashboards ); |
| 2099 | 1784 | // phpcs:ignore |
| @@ -2141,21 +1826,20 @@ | ||
| 2141 | 1826 | public static function save() { |
| 2142 | 1827 | $wp_nonce = ( isset( $_POST['wp_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wp_nonce'] ) ) : '' ); |
| 2143 | 1828 | if ( !wp_verify_nonce( $wp_nonce, static::DASHBOARD_SAVE . WPDA::get_current_user_login() ) ) { |
| 2144 | 1829 | WPDA::sent_header( 'application/json' ); |
| 2145 | - echo static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2146 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1830 | + static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2147 | 1831 | wp_die(); |
| 2148 | 1832 | } |
| 1833 | + // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 2149 | 1834 | $widgets = ( isset( $_POST['wpda_widgets'] ) ? WPDA::sanitize_text_field_array( $_POST['wpda_widgets'] ) : array() ); |
| 2150 | - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput | |
| 1835 | + // phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 2151 | 1836 | $save = array(); |
| 2152 | 1837 | foreach ( $widgets as $widget ) { |
| 2153 | 1838 | $save[$widget['widgetName']] = $widget; |
| 2154 | 1839 | } |
| 2155 | 1840 | update_user_meta( WPDA::get_current_user_id(), self::USER_DASHBOARD, $save ); |
| 2156 | - echo self::msg( 'SUCCESS', 'Widget succesfully saved' ); | |
| 2157 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1841 | + self::msg( 'SUCCESS', 'Widget succesfully saved' ); | |
| 2158 | 1842 | wp_die(); |
| 2159 | 1843 | } |
| 2160 | 1844 | |
| 2161 | 1845 | /** |
| @@ -2166,10 +1850,9 @@ | ||
| 2166 | 1850 | public static function get_list() { |
| 2167 | 1851 | $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' ); |
| 2168 | 1852 | if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) { |
| 2169 | 1853 | WPDA::sent_header( 'application/json' ); |
| 2170 | - echo static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2171 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1854 | + static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2172 | 1855 | wp_die(); |
| 2173 | 1856 | } |
| 2174 | 1857 | // Placeholder: implemented in the premium version. |
| 2175 | 1858 | echo ''; |
| @@ -2184,10 +1867,9 @@ | ||
| 2184 | 1867 | public static function delete_widget() { |
| 2185 | 1868 | $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' ); |
| 2186 | 1869 | if ( !wp_verify_nonce( $wp_nonce, self::DASHBOARD_SAVE . WPDA::get_current_user_login() ) ) { |
| 2187 | 1870 | WPDA::sent_header( 'application/json' ); |
| 2188 | - echo static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2189 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1871 | + static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2190 | 1872 | wp_die(); |
| 2191 | 1873 | } |
| 2192 | 1874 | // Placeholder: implemented in the premium version. |
| 2193 | 1875 | echo ''; |
| @@ -2202,10 +1884,9 @@ | ||
| 2202 | 1884 | public static function edit_chart() { |
| 2203 | 1885 | $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' ); |
| 2204 | 1886 | if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) { |
| 2205 | 1887 | WPDA::sent_header( 'application/json' ); |
| 2206 | - echo static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2207 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1888 | + static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2208 | 1889 | wp_die(); |
| 2209 | 1890 | } |
| 2210 | 1891 | // Placeholder: implemented in the premium version. |
| 2211 | 1892 | echo ''; |
| @@ -2220,10 +1901,9 @@ | ||
| 2220 | 1901 | public static function load_widget() { |
| 2221 | 1902 | $wp_nonce = ( isset( $_POST['wpda_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpda_wpnonce'] ) ) : '' ); |
| 2222 | 1903 | if ( !wp_verify_nonce( $wp_nonce, WPDA_Widget::WIDGET_REFRESH . WPDA::get_current_user_login() ) ) { |
| 2223 | 1904 | WPDA::sent_header( 'application/json' ); |
| 2224 | - echo static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2225 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1905 | + static::msg( 'ERROR', 'Token expired, please refresh page' ); | |
| 2226 | 1906 | wp_die(); |
| 2227 | 1907 | } |
| 2228 | 1908 | // Placeholder: implemented in the premium version. |
| 2229 | 1909 | echo ''; |
| @@ -2266,13 +1946,13 @@ | ||
| 2266 | 1946 | * @return false|string |
| 2267 | 1947 | */ |
| 2268 | 1948 | public static function msg( $status, $msg ) { |
| 2269 | 1949 | $error = array( |
| 2270 | - 'status' => $status, | |
| 1950 | + 'status' => esc_attr( $status ), | |
| 2271 | 1951 | 'msg' => $msg, |
| 2272 | 1952 | ); |
| 2273 | - return json_encode( $error ); | |
| 2274 | - // phpcs:ignore | |
| 1953 | + echo json_encode( $error ); | |
| 1954 | + // phpcs:ignore WordPress.Security.EscapeOutput | |
| 2275 | 1955 | } |
| 2276 | 1956 | |
| 2277 | 1957 | private function get_promotions( $tool ) { |
| 2278 | 1958 | switch ( $tool ) { |
| @@ -2287,9 +1967,9 @@ | ||
| 2287 | 1967 | default: |
| 2288 | 1968 | $promotions = array(); |
| 2289 | 1969 | } |
| 2290 | 1970 | if ( count( $promotions ) > 0 ) { |
| 2291 | - //phpcs:ignore - 8.1 proof | |
| 1971 | + // phpcs:ignore -- 8.1 proof | |
| 2292 | 1972 | $promotion_index = random_int( 0, count( $promotions ) - 1 ); |
| 2293 | 1973 | $promotion = $promotions[$promotion_index]; |
| 2294 | 1974 | $promotion_text = key( $promotion ); |
| 2295 | 1975 | $promotion_url = $promotion[$promotion_text][0]; |
| @@ -2316,4 +1996,6 @@ | ||
| 2316 | 1996 | } |
| 2317 | 1997 | } |
| 2318 | 1998 | |
| 2319 | 1999 | } |
| 2000 | + | |
| 2001 | +// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |