Plugin Directory

Changeset 2887316


Ignore:
Timestamp:
03/27/2023 05:37:36 AM (3 years ago)
Author:
supportcandy
Message:

version 3.1.4

Location:
supportcandy
Files:
575 added
16 edited

Legend:

Unmodified
Added
Removed
  • supportcandy/trunk/class-wpsc-installation.php

    r2873748 r2887316  
    289289                    from_email VARCHAR(200) NULL DEFAULT NULL,
    290290                    reply_to VARCHAR(200) NULL DEFAULT NULL,
    291                     subject VARCHAR(200) NULL DEFAULT NULL,
     291                    subject TEXT NULL DEFAULT NULL,
    292292                    body LONGTEXT NULL DEFAULT NULL,
    293293                    to_email TEXT NULL DEFAULT NULL,
     
    16191619            }
    16201620
     1621            self::attachment_security_file();
     1622
    16211623            // update string translations.
    16221624            update_option( 'wpsc-string-translation', $string_translations );
     
    16271629         */
    16281630        public static function upgrade() {
     1631
     1632            global $wpdb;
    16291633
    16301634            if ( version_compare( self::$current_version, '3.0.4', '<' ) ) {
     
    16721676            }
    16731677
     1678            if ( version_compare( self::$current_version, '3.1.4', '<' ) ) {
     1679
     1680                // add scheduled task for ticket data upgrade.
     1681                $wpdb->insert(
     1682                    $wpdb->prefix . 'psmsc_scheduled_tasks',
     1683                    array(
     1684                        'class'             => 'WPSC_SC_Upgrade',
     1685                        'method'            => 'update_ticket_attachment_path',
     1686                        'is_manual'         => 1,
     1687                        'warning_text'      => 'SupportCandy - Database attachment paths upgrade needed.',
     1688                        'warning_link_text' => 'Upgrade Now',
     1689                        'progressbar_text'  => 'Updating attachment paths...',
     1690                    )
     1691                );
     1692
     1693                self::attachment_security_file();
     1694            }
     1695
    16741696            self::set_upgrade_complete();
    16751697        }
     
    16961718            WPSC_Cron::unschedule_events();
    16971719        }
     1720
     1721        /**
     1722         * Add htaccess file in supportcandy attachment folder
     1723         *
     1724         * @return void
     1725         */
     1726        public static function attachment_security_file() {
     1727
     1728            $upload_dir = wp_upload_dir();
     1729            $wpsc_dir = $upload_dir['basedir'] . '/wpsc';
     1730            if ( ! is_file( $wpsc_dir . '/.htaccess' ) ) {
     1731                @file_put_contents( $wpsc_dir . '/.htaccess', 'deny from all' ); //phpcs:ignore
     1732            }
     1733        }
    16981734    }
    16991735endif;
  • supportcandy/trunk/framework/style-rtl.css

    r2873748 r2887316  
    312312.wpsc-filter-actions .action-devider {
    313313    height: 18px;
    314     border: 1px solid #2c3e50;
     314    border-right: 1px solid #2c3e50;
    315315    margin: 0 5px;
    316316}
     
    14191419    height: 18px !important;
    14201420    box-sizing: border-box;
     1421    padding: 8px;
    14211422}
    14221423#wpsc-container .checkbox-container label:after,
  • supportcandy/trunk/framework/style.css

    r2873748 r2887316  
    311311.wpsc-filter-actions .action-devider {
    312312    height: 18px;
    313     border: 1px solid #2c3e50;
     313    border-left: 1px solid #2c3e50;
    314314    margin: 0 5px;
    315315}
     
    14181418    height: 18px !important;
    14191419    box-sizing: border-box;
     1420    padding: 8px;
    14201421}
    14211422#wpsc-container .checkbox-container label:after,
  • supportcandy/trunk/includes/admin/settings/miscellaneous-settings/class-wpsc-ms-gdpr.php

    r2822852 r2887316  
    247247            if ( intval( $gdpr['allow-gdpr'] ) === 1 ) {
    248248                ?>
    249                 <div class="wpsc-tff gdpr wpsc-xs-12 wpsc-sm-12 wpsc-md-12 wpsc-lg-12 required wpsc-visible" data-cft="gdpr">
     249                <div class="wpsc-tff wpsc-gdpr wpsc-xs-12 wpsc-sm-12 wpsc-md-12 wpsc-lg-12 required wpsc-visible" data-cft="gdpr">
    250250                    <div class="checkbox-container">
    251251                        <?php $unique_id = uniqid( 'wpsc_' ); ?>
  • supportcandy/trunk/includes/admin/settings/text-editor-settings/class-wpsc-text-editor.php

    r2793251 r2887316  
    265265                    wp_autoresize_on: true,
    266266                    plugins: [
    267                     'lists link directionality wpautoresize textcolor <?php echo $advanced['html-pasting'] == 0 ? 'paste' : ''; ?>'
     267                    'lists link directionality wpautoresize textcolor paste'
    268268                    ],
    269269                    <?php echo $advanced['html-pasting'] == 0 ? 'paste_as_text: true,' : ''; ?>
     
    277277                    remove_script_host : false,
    278278                    convert_urls : true,
     279                    paste_data_images: true,
     280                    images_upload_handler: function (blobInfo, success, failure) {
     281
     282                        form_data = new FormData();
     283                        form_data.append('file', blobInfo.blob(), blobInfo.filename());
     284                        form_data.append('action','wpsc_tinymce_upload_file');
     285                        form_data.append('_ajax_nonce', '<?php echo esc_attr( wp_create_nonce( 'wpsc_tinymce_upload_file' ) ); ?>');
     286
     287                        jQuery.ajax({
     288                            type : 'post',
     289                            url : supportcandy.ajax_url,
     290                            cache: false,
     291                            contentType: false,
     292                            processData: false,
     293                            data: form_data,
     294                            success: function(res){
     295                                success(res.imgURL);
     296                            }
     297                        });
     298                    },
    279299                    setup: function (editor) {
    280300                        editor.on('blur', function(e) {
  • supportcandy/trunk/includes/admin/tickets/class-wpsc-individual-ticket.php

    r2873748 r2887316  
    396396                ?>
    397397                <span
    398                     class="wpsc-link"
     398                    class="wpsc-link wpsc-it-<?php echo esc_attr( $key ); ?>"
    399399                    onclick="<?php echo esc_attr( $action['callback'] ); ?>">
    400400                    <?php echo esc_attr( $action['label'] ); ?>
     
    10861086                                <div class="wpsc-attachment-item">
    10871087                                    <?php
    1088                                     $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id;
     1088                                    $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id . '&auth_code=' . $thread->ticket->auth_code;
    10891089                                    ?>
    10901090                                    <a class="wpsc-link" href="<?php echo esc_attr( $download_url ); ?>" target="_blank">
     
    22452245                mkdir( $filepath, 0755, true );
    22462246            }
    2247             $filepath         .= '/' . $filename . '.' . $extension;
    2248             $data['file_path'] = $filepath;
     2247            $filepath .= '/' . $filename . '.' . $extension;
     2248
     2249            $filepath_short = '/wpsc/' . $today->format( 'Y' ) . '/' . $today->format( 'm' ) . '/' . $filename . '.' . $extension;
     2250            $data['file_path'] = $filepath_short;
    22492251
    22502252            // Create time.
     
    22522254
    22532255            // copy to path.
    2254             copy( $attachment->file_path, $filepath );
     2256            copy( $upload_dir['basedir'] . $attachment->file_path, $filepath );
    22552257            $data['is_active'] = 1;
    22562258            $new_attachement   = WPSC_Attachment::insert( $data );
  • supportcandy/trunk/includes/class-wpsc-email-notifications.php

    r2848878 r2887316  
    167167                }
    168168                $filepath .= '/' . $attachment->name;
    169                 copy( $attachment->file_path, $filepath );
     169                copy( $upload_dir['basedir'] . $attachment->file_path, $filepath );
    170170                $attachments[] = $filepath;
    171171            endforeach;
  • supportcandy/trunk/includes/class-wpsc-functions.php

    r2873748 r2887316  
    225225                    case 'IS NOT':
    226226                        $filter_str[] = $slug . ' IS NOT NULL';
     227                        break;
     228
     229                    case 'LIKE':
     230                        $filter_str[] = $slug . ' ' . $compare . ' \'%' . $val . '%\'';
    227231                        break;
    228232                }
  • supportcandy/trunk/includes/class-wpsc-macros.php

    r2763565 r2887316  
    672672                    )
    673673                );
    674                 $history = implode( '<br><hr><br>', $history );
     674                $history = implode( '<div></div><br><hr><br><div></div>', $history );
    675675                return str_replace( '{{ticket_history_all_with_notes}}', $history, $str );
    676676
  • supportcandy/trunk/includes/custom-field-types/class-wpsc-cf-file-attachment-multiple.php

    r2873748 r2887316  
    989989                    <div class="wpsc-attachment-item">
    990990                        <?php
    991                         $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id;
     991                        $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id . '&auth_code=' . $ticket->auth_code;
    992992                        ?>
    993993                        <a class="wpsc-link" href="<?php echo esc_url( $download_url ); ?>" target="_blank">
     
    10961096            <div>
    10971097                <?php
     1098                $ticket = new WPSC_Ticket( $attachments[0]->ticket_id );
    10981099                foreach ( $attachments as $attachment ) {
    10991100                    ?>
    11001101                    <div class="wpsc-attachment-item">
    11011102                        <?php
    1102                         $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id;
     1103                        $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id . '&auth_code=' . $ticket->auth_code;
    11031104                        ?>
    11041105                        <a class="wpsc-link" href="<?php echo esc_url( $download_url ); ?>" target="_blank">
  • supportcandy/trunk/includes/custom-field-types/class-wpsc-cf-file-attachment-single.php

    r2873748 r2887316  
    930930                <div class="wpsc-attachment-item">
    931931                    <?php
    932                     $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id;
     932                    $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id . '&auth_code=' . $ticket->auth_code;
    933933                    ?>
    934934                    <a class="wpsc-link" href="<?php echo esc_url( $download_url ); ?>" target="_blank">
     
    995995                return;
    996996            }
    997 
     997            $ticket = new WPSC_Ticket( $attachment->ticket_id );
    998998            ?>
    999999            <div class="wpsc-attachment-item">
    10001000                <?php
    1001                 $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id;
     1001                $download_url = site_url( '/' ) . '?wpsc_attachment=' . $attachment->id . '&auth_code=' . $ticket->auth_code;
    10021002                ?>
    10031003                <a class="wpsc-link" href="<?php echo esc_url( $download_url ); ?>" target="_blank">
  • supportcandy/trunk/includes/models/class-wpsc-attachment.php

    r2873748 r2887316  
    468468            foreach ( $attachments as $attachment ) {
    469469
    470                 if ( file_exists( $attachment->file_path ) ) {
    471                     unlink( $attachment->file_path );
     470                $upload_dir = wp_upload_dir();
     471                $file_path = $upload_dir['basedir'] . $attachment->file_path;
     472                if ( file_exists( $file_path ) ) {
     473                    unlink( $file_path );
    472474                }
    473475
     
    540542                mkdir( $file_path, 0755, true );
    541543            }
    542             $file_path        .= '/' . $filename;
    543             $data['file_path'] = $file_path;
     544            $file_path .= '/' . $filename;
     545
     546            $filepath_short = '/wpsc/' . $today->format( 'Y' ) . '/' . $today->format( 'm' ) . '/' . $filename;
     547            $data['file_path'] = $filepath_short;
    544548
    545549            // Insert record in database.
     
    965969                    return;
    966970                }
    967 
     971                $auth_code = isset($_REQUEST['auth_code']) ? sanitize_text_field( $_REQUEST['auth_code'] ) : ''; // phpcs:ignore
     972                $advanced = get_option( 'wpsc-ms-advanced-settings' );
    968973                switch ( $attachment->source ) {
    969974
     
    991996                            if ( ! (
    992997                                ( $current_user->is_agent && WPSC_Individual_Ticket::has_ticket_cap( 'view' ) ) ||
    993                                 WPSC_Individual_Ticket::is_customer()
     998                                WPSC_Individual_Ticket::is_customer() ||
     999                                ( ! $advanced['ticket-url-auth'] && $ticket->auth_code == $auth_code )
    9941000                            ) ) {
    9951001                                wp_send_json_error( 'Unauthorized!', 401 );
     
    10331039                        if ( ! (
    10341040                            ( $current_user->is_agent && WPSC_Individual_Ticket::has_ticket_cap( 'view' ) ) ||
    1035                             WPSC_Individual_Ticket::is_customer()
     1041                            WPSC_Individual_Ticket::is_customer() ||
     1042                            ( ! $advanced['ticket-url-auth'] && $ticket->auth_code == $auth_code )
    10361043                        ) ) {
    10371044                            wp_send_json_error( 'Unauthorized!', 401 );
     
    10841091            }
    10851092
    1086             if ( ! file_exists( $attachment->file_path ) ) {
     1093            $upload_dir = wp_upload_dir();
     1094            $file_path = $upload_dir['basedir'] . $attachment->file_path;
     1095            if ( ! file_exists( $file_path ) ) {
    10871096                return;
    10881097            }
     
    10941103                    ob_clean();
    10951104                }
    1096                 header( 'Content-Type: ' . mime_content_type( $attachment->file_path ) );
    1097                 readfile( $attachment->file_path ); // phpcs:ignore
     1105                header( 'Content-Type: ' . mime_content_type( $file_path ) );
     1106                readfile( $file_path ); // phpcs:ignore
    10981107                exit( 0 );
    10991108            }
     
    11031112            header( 'Content-Type: application/force-download' );
    11041113            header( 'Content-Disposition: attachment;filename="' . $attachment->name . '"' );
    1105             header( 'Content-Length: ' . filesize( $attachment->file_path ) );
     1114            header( 'Content-Length: ' . filesize( $file_path ) );
    11061115            flush();
    1107             readfile( $attachment->file_path ); // phpcs:ignore
     1116            readfile( $file_path ); // phpcs:ignore
    11081117            exit( 0 );
    11091118        }
     
    11501159            $file_path .= '/' . $filename;
    11511160
     1161            $filepath_short = '/wpsc/' . $today->format( 'Y' ) . '/' . $today->format( 'm' ) . '/' . $filename;
     1162
    11521163            // Init attachment data.
    11531164            $data = array(
    11541165                'name'         => sanitize_file_name( $file['name'] ),
    1155                 'file_path'    => $file_path,
     1166                'file_path'    => $filepath_short,
    11561167                'is_image'     => 1,
    11571168                'date_created' => $today->format( 'Y-m-d H:i:s' ),
  • supportcandy/trunk/includes/models/class-wpsc-ticket.php

    r2798663 r2887316  
    520520                $val     = isset( $filter['val'] ) ? $filter['val'] : false;
    521521                if ( ! $slug || ! $compare || $val === false ) {
    522                     return '1=1';
    523                 }
    524 
    525                 // Get custom field object for the slug.
    526                 $cf = WPSC_Custom_Field::get_cf_by_slug( $slug );
    527                 if ( ! $cf ) {
    528                     return '1=1';
    529                 }
    530 
    531                 $filter_str[] = $cf->type::parse_filter( $cf, $compare, $val );
     522                    $filter_str[] = '1=1';
     523                }
     524
     525                // custom filter.
     526                if ( $slug === 'custom_query' ) {
     527
     528                    $filter_str[] = $val;
     529
     530                } else {
     531
     532                    // Get custom field object for the slug.
     533                    $cf = WPSC_Custom_Field::get_cf_by_slug( $slug );
     534                    $filter_str[] = $cf ? $cf->type::parse_filter( $cf, $compare, $val ) : '1=1';
     535                }
    532536            }
    533537
  • supportcandy/trunk/includes/rest-api/class-wpsc-rest-attachment.php

    r2873748 r2887316  
    107107                mkdir( $file_path, 0755, true );
    108108            }
    109             $file_path        .= '/' . $filename;
    110             $data['file_path'] = $file_path;
     109            $file_path .= '/' . $filename;
     110
     111            $filepath_short = '/wpsc/' . $today->format( 'Y' ) . '/' . $today->format( 'm' ) . '/' . $filename;
     112            $data['file_path'] = $filepath_short;
    111113
    112114            // Insert record in database.
  • supportcandy/trunk/readme.txt

    r2873748 r2887316  
    66Tested up to: 6.1
    77Requires PHP: 7.4
    8 Stable tag: 3.1.3
     8Stable tag: 3.1.4
    99
    1010== Description ==
     
    8383* Greek
    8484* Portuguese (Brazil)
     85* Turkish
     86* Swedish
    8587
    8688If you are a translator, you can get free access to all premium add-ons for a year in exchange for translating them into your language if it is not available already. We will renew the Premium subscription next year if you continue contributing to the translation. If interested, don't hesitate to contact us via our [support page](https://supportcandy.net/support-ticket/).
     
    103105
    104106== Changelog ==
     107
     108= 3.1.4 (March 27, 2023) =
     109* New: Copy/paste images in reply box.
     110* Fix: Unable to download attachments if server is changed
     111* Fix: Email notifications does not send if the ticket subject is very long
     112* Fix: Unable to create a ticket on brave browser
     113* Fix: Attachment security fixes
    105114
    106115= 3.1.3 (March 02, 2023) =
  • supportcandy/trunk/supportcandy.php

    r2873748 r2887316  
    44 * Plugin URI: https://wordpress.org/plugins/supportcandy/
    55 * Description: Easy & Powerful support ticket system for WordPress
    6  * Version: 3.1.3
     6 * Version: 3.1.4
    77 * Author: SupportCandy
    88 * Author URI: https://supportcandy.net/
     
    3131         * @var string
    3232         */
    33         public static $version = '3.1.3';
     33        public static $version = '3.1.4';
    3434
    3535        /**
Note: See TracChangeset for help on using the changeset viewer.