Plugin Directory

Changeset 3449507


Ignore:
Timestamp:
01/29/2026 11:02:25 AM (2 months ago)
Author:
picocodes
Message:

Update to version 1.2.8 from GitHub

Location:
hizzle-downloads
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • hizzle-downloads/tags/1.2.8/hizzle-downloads.php

    r3435015 r3449507  
    44 * Plugin URI: https://hizzle.co/download-manager/
    55 * Description: A lightweight download manager plugin.
    6  * Version: 1.2.7
     6 * Version: 1.2.8
    77 * Author: Hizzle
    88 * Author URI: https://hizzle.co
     
    2222
    2323if ( ! defined( 'HIZZLE_DOWNLOADS_VERSION' ) ) {
    24     define( 'HIZZLE_DOWNLOADS_VERSION', '1.2.7' );
     24    define( 'HIZZLE_DOWNLOADS_VERSION', '1.2.8' );
    2525}
    2626
  • hizzle-downloads/tags/1.2.8/readme.txt

    r3435015 r3449507  
    55Tested up to: 6.9
    66Requires PHP: 5.6
    7 Version: 1.2.7
    8 Stable tag: 1.2.7
     7Version: 1.2.8
     8Stable tag: 1.2.8
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    132132== Changelog ==
    133133
     134= 1.2.8 =
     135- Update composer packages.
     136
    134137= 1.2.7 =
    135138- Update composer packages.
  • hizzle-downloads/tags/1.2.8/src/Download_Handler.php

    r2908611 r3449507  
    4545        // Abort if the file doesn't exist.
    4646        if ( is_wp_error( $file ) ) {
    47             return $this->download_error( $file );
     47            return $this->download_error( $file, 404 );
    4848        }
    4949
    5050        // Abort if the file is not downloadable.
    5151        if ( ! $file->is_downloadable() ) {
    52             return $this->download_error( new \WP_Error( 'hizzle_downloads_file_not_downloadable', __( 'This file is not downloadable.', 'hizzle-downloads' ) ) );
     52            return $this->download_error( new \WP_Error( 'hizzle_downloads_file_not_downloadable', __( 'This file is not downloadable.', 'hizzle-downloads' ) ), 400 );
    5353        }
    5454
    5555        // Check if the current user can download the file.
    5656        if ( ! $file->current_user_can_download() ) {
    57             return $this->download_error( new \WP_Error( 'hizzle_downloads_user_cannot_download', __( 'You do not have permission to download this file.', 'hizzle-downloads' ) ) );
     57            return $this->download_error( new \WP_Error( 'hizzle_downloads_user_cannot_download', __( 'You do not have permission to download this file.', 'hizzle-downloads' ) ), 403 );
    5858        }
    5959
     
    6767
    6868        try {
    69             $download_range   = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) );  // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
     69            $download_range = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) );  // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
    7070
    7171            // Track the download.
     
    8282        } catch ( \Exception $e ) {
    8383            $this->log( $e->getMessage(), 'error', $parsed_file_path );
    84             $this->download_error( new \WP_Error( 'hizzle_downloads_error', $e->getMessage() ) );
     84            $this->download_error( new \WP_Error( 'hizzle_downloads_error', $e->getMessage() ), 500 );
    8585        }
    8686
     
    103103        // Check the password.
    104104        if ( ! hash_equals( wp_unslash( $_POST['hizzle_downloads_file_password'] ), $file->get_password() ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
    105             $this->download_error( new \WP_Error( 'hizzle_downloads_password_incorrect', __( 'The password you entered is incorrect. Please try again.', 'hizzle-downloads' ) ), $file );
    106         }
    107 
     105            $this->download_error(
     106                new \WP_Error( 'hizzle_downloads_password_incorrect', __( 'The password you entered is incorrect. Please try again.', 'hizzle-downloads' ) ),
     107                403
     108            );
     109        }
    108110    }
    109111
     
    198200                do_action( 'hizzle_download_file_redirect', $file );
    199201            } else {
    200                 self::download_error( __( 'File not found', 'hizzle-downloads' ) );
     202                self::download_error( __( 'File not found', 'hizzle-downloads' ), 404 );
    201203            }
    202204        }
     
    451453     * @param \WP_Error $error The error to display.
    452454     */
    453     private function download_error( $error ) {
     455    private function download_error( $error, $code = 400 ) {
    454456
    455457        /*
     
    466468        }
    467469
    468         wp_die( $error, 400 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     470        wp_die( $error, $code ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    469471    }
    470472
  • hizzle-downloads/tags/1.2.8/vendor/composer/installed.json

    r3435015 r3449507  
    5454        {
    5555            "name": "hizzle/store",
    56             "version": "0.2.17",
    57             "version_normalized": "0.2.17.0",
     56            "version": "0.2.18",
     57            "version_normalized": "0.2.18.0",
    5858            "source": {
    5959                "type": "git",
    6060                "url": "https://github.com/hizzle-co/datastore.git",
    61                 "reference": "1b867f0c029c87431ccfb9c76821f868d1d63875"
     61                "reference": "a01cea3f0018b11500c4748cbc410c2d362291c2"
    6262            },
    6363            "dist": {
    6464                "type": "zip",
    65                 "url": "https://api.github.com/repos/hizzle-co/datastore/zipball/1b867f0c029c87431ccfb9c76821f868d1d63875",
    66                 "reference": "1b867f0c029c87431ccfb9c76821f868d1d63875",
     65                "url": "https://api.github.com/repos/hizzle-co/datastore/zipball/a01cea3f0018b11500c4748cbc410c2d362291c2",
     66                "reference": "a01cea3f0018b11500c4748cbc410c2d362291c2",
    6767                "shasum": ""
    6868            },
     
    7070                "php": ">=5.3.0"
    7171            },
    72             "time": "2026-01-08T09:55:37+00:00",
     72            "time": "2026-01-26T15:11:28+00:00",
    7373            "type": "library",
    7474            "installation-source": "dist",
     
    9999            "support": {
    100100                "issues": "https://github.com/hizzle-co/datastore/issues",
    101                 "source": "https://github.com/hizzle-co/datastore/tree/0.2.17"
     101                "source": "https://github.com/hizzle-co/datastore/tree/0.2.18"
    102102            },
    103103            "install-path": "../hizzle/store"
  • hizzle-downloads/tags/1.2.8/vendor/composer/installed.php

    r3435015 r3449507  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',
     6        'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',
     16            'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
     
    3030        ),
    3131        'hizzle/store' => array(
    32             'pretty_version' => '0.2.17',
    33             'version' => '0.2.17.0',
    34             'reference' => '1b867f0c029c87431ccfb9c76821f868d1d63875',
     32            'pretty_version' => '0.2.18',
     33            'version' => '0.2.18.0',
     34            'reference' => 'a01cea3f0018b11500c4748cbc410c2d362291c2',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../hizzle/store',
  • hizzle-downloads/tags/1.2.8/vendor/hizzle/store/src/Query.php

    r3435015 r3449507  
    340340    }
    341341
    342     private function get_mysql_timezone_offset() {
     342    /**
     343     * @param array $qv The query vars.
     344     */
     345    private function get_mysql_timezone_offset( $qv ) {
    343346        $offset = get_option( 'gmt_offset', 0 );
    344347
    345         // Ensure offset is a float in minutes
    346         $offset = floatval( $offset ) * 60;
     348        if ( isset( $qv['hizzle_timezone_offset'] ) ) {
     349            $offset = floatval( $qv['hizzle_timezone_offset'] );
     350        } else {
     351            // Ensure offset is a float in minutes
     352            $offset = floatval( $offset ) * 60;
     353        }
    347354
    348355        if ( 0 > $offset ) {
     356            $offset = abs( $offset );
    349357            return "DATE_SUB(%s, INTERVAL $offset MINUTE)";
    350358        }
     
    429437
    430438            foreach ( array_filter( $aggregate ) as $function ) {
     439                $distinct = false;
    431440
    432441                if ( is_array( $function ) ) {
     
    437446                    $as          = isset( $function['as'] ) ? esc_sql( $function['as'] ) : strtolower( $function['function'] ) . '_' . $field;
    438447                    $query_field = isset( $function['expression'] ) ? $this->prepare_math_expression( $function['expression'], $field ) : $table_field;
     448                    $distinct    = ! empty( $function['distinct'] );
    439449                    $function    = $function['function'];
    440450                } else {
     
    449459                }
    450460
    451                 $this->query_fields[] = "$function_upper($query_field) AS $as";
     461                if ( $distinct ) {
     462                    $this->query_fields[] = "$function_upper(DISTINCT $query_field) AS $as";
     463                } else {
     464                    $this->query_fields[] = "$function_upper($query_field) AS $as";
     465                }   
    452466            }
    453467        }
    454468
    455469        // Prepare groupby fields.
    456         $timezone_offset = $this->get_mysql_timezone_offset();
     470        $timezone_offset = $this->get_mysql_timezone_offset( $qv );
    457471        if ( ! empty( $qv['groupby'] ) ) {
    458472            foreach ( wp_parse_list( $qv['groupby'] ) as $index => $field ) {
  • hizzle-downloads/trunk/hizzle-downloads.php

    r3435015 r3449507  
    44 * Plugin URI: https://hizzle.co/download-manager/
    55 * Description: A lightweight download manager plugin.
    6  * Version: 1.2.7
     6 * Version: 1.2.8
    77 * Author: Hizzle
    88 * Author URI: https://hizzle.co
     
    2222
    2323if ( ! defined( 'HIZZLE_DOWNLOADS_VERSION' ) ) {
    24     define( 'HIZZLE_DOWNLOADS_VERSION', '1.2.7' );
     24    define( 'HIZZLE_DOWNLOADS_VERSION', '1.2.8' );
    2525}
    2626
  • hizzle-downloads/trunk/readme.txt

    r3435015 r3449507  
    55Tested up to: 6.9
    66Requires PHP: 5.6
    7 Version: 1.2.7
    8 Stable tag: 1.2.7
     7Version: 1.2.8
     8Stable tag: 1.2.8
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    132132== Changelog ==
    133133
     134= 1.2.8 =
     135- Update composer packages.
     136
    134137= 1.2.7 =
    135138- Update composer packages.
  • hizzle-downloads/trunk/src/Download_Handler.php

    r2908611 r3449507  
    4545        // Abort if the file doesn't exist.
    4646        if ( is_wp_error( $file ) ) {
    47             return $this->download_error( $file );
     47            return $this->download_error( $file, 404 );
    4848        }
    4949
    5050        // Abort if the file is not downloadable.
    5151        if ( ! $file->is_downloadable() ) {
    52             return $this->download_error( new \WP_Error( 'hizzle_downloads_file_not_downloadable', __( 'This file is not downloadable.', 'hizzle-downloads' ) ) );
     52            return $this->download_error( new \WP_Error( 'hizzle_downloads_file_not_downloadable', __( 'This file is not downloadable.', 'hizzle-downloads' ) ), 400 );
    5353        }
    5454
    5555        // Check if the current user can download the file.
    5656        if ( ! $file->current_user_can_download() ) {
    57             return $this->download_error( new \WP_Error( 'hizzle_downloads_user_cannot_download', __( 'You do not have permission to download this file.', 'hizzle-downloads' ) ) );
     57            return $this->download_error( new \WP_Error( 'hizzle_downloads_user_cannot_download', __( 'You do not have permission to download this file.', 'hizzle-downloads' ) ), 403 );
    5858        }
    5959
     
    6767
    6868        try {
    69             $download_range   = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) );  // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
     69            $download_range = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) );  // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
    7070
    7171            // Track the download.
     
    8282        } catch ( \Exception $e ) {
    8383            $this->log( $e->getMessage(), 'error', $parsed_file_path );
    84             $this->download_error( new \WP_Error( 'hizzle_downloads_error', $e->getMessage() ) );
     84            $this->download_error( new \WP_Error( 'hizzle_downloads_error', $e->getMessage() ), 500 );
    8585        }
    8686
     
    103103        // Check the password.
    104104        if ( ! hash_equals( wp_unslash( $_POST['hizzle_downloads_file_password'] ), $file->get_password() ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
    105             $this->download_error( new \WP_Error( 'hizzle_downloads_password_incorrect', __( 'The password you entered is incorrect. Please try again.', 'hizzle-downloads' ) ), $file );
    106         }
    107 
     105            $this->download_error(
     106                new \WP_Error( 'hizzle_downloads_password_incorrect', __( 'The password you entered is incorrect. Please try again.', 'hizzle-downloads' ) ),
     107                403
     108            );
     109        }
    108110    }
    109111
     
    198200                do_action( 'hizzle_download_file_redirect', $file );
    199201            } else {
    200                 self::download_error( __( 'File not found', 'hizzle-downloads' ) );
     202                self::download_error( __( 'File not found', 'hizzle-downloads' ), 404 );
    201203            }
    202204        }
     
    451453     * @param \WP_Error $error The error to display.
    452454     */
    453     private function download_error( $error ) {
     455    private function download_error( $error, $code = 400 ) {
    454456
    455457        /*
     
    466468        }
    467469
    468         wp_die( $error, 400 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     470        wp_die( $error, $code ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    469471    }
    470472
  • hizzle-downloads/trunk/vendor/composer/installed.json

    r3435015 r3449507  
    5454        {
    5555            "name": "hizzle/store",
    56             "version": "0.2.17",
    57             "version_normalized": "0.2.17.0",
     56            "version": "0.2.18",
     57            "version_normalized": "0.2.18.0",
    5858            "source": {
    5959                "type": "git",
    6060                "url": "https://github.com/hizzle-co/datastore.git",
    61                 "reference": "1b867f0c029c87431ccfb9c76821f868d1d63875"
     61                "reference": "a01cea3f0018b11500c4748cbc410c2d362291c2"
    6262            },
    6363            "dist": {
    6464                "type": "zip",
    65                 "url": "https://api.github.com/repos/hizzle-co/datastore/zipball/1b867f0c029c87431ccfb9c76821f868d1d63875",
    66                 "reference": "1b867f0c029c87431ccfb9c76821f868d1d63875",
     65                "url": "https://api.github.com/repos/hizzle-co/datastore/zipball/a01cea3f0018b11500c4748cbc410c2d362291c2",
     66                "reference": "a01cea3f0018b11500c4748cbc410c2d362291c2",
    6767                "shasum": ""
    6868            },
     
    7070                "php": ">=5.3.0"
    7171            },
    72             "time": "2026-01-08T09:55:37+00:00",
     72            "time": "2026-01-26T15:11:28+00:00",
    7373            "type": "library",
    7474            "installation-source": "dist",
     
    9999            "support": {
    100100                "issues": "https://github.com/hizzle-co/datastore/issues",
    101                 "source": "https://github.com/hizzle-co/datastore/tree/0.2.17"
     101                "source": "https://github.com/hizzle-co/datastore/tree/0.2.18"
    102102            },
    103103            "install-path": "../hizzle/store"
  • hizzle-downloads/trunk/vendor/composer/installed.php

    r3435015 r3449507  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',
     6        'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',
     16            'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
     
    3030        ),
    3131        'hizzle/store' => array(
    32             'pretty_version' => '0.2.17',
    33             'version' => '0.2.17.0',
    34             'reference' => '1b867f0c029c87431ccfb9c76821f868d1d63875',
     32            'pretty_version' => '0.2.18',
     33            'version' => '0.2.18.0',
     34            'reference' => 'a01cea3f0018b11500c4748cbc410c2d362291c2',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../hizzle/store',
  • hizzle-downloads/trunk/vendor/hizzle/store/src/Query.php

    r3435015 r3449507  
    340340    }
    341341
    342     private function get_mysql_timezone_offset() {
     342    /**
     343     * @param array $qv The query vars.
     344     */
     345    private function get_mysql_timezone_offset( $qv ) {
    343346        $offset = get_option( 'gmt_offset', 0 );
    344347
    345         // Ensure offset is a float in minutes
    346         $offset = floatval( $offset ) * 60;
     348        if ( isset( $qv['hizzle_timezone_offset'] ) ) {
     349            $offset = floatval( $qv['hizzle_timezone_offset'] );
     350        } else {
     351            // Ensure offset is a float in minutes
     352            $offset = floatval( $offset ) * 60;
     353        }
    347354
    348355        if ( 0 > $offset ) {
     356            $offset = abs( $offset );
    349357            return "DATE_SUB(%s, INTERVAL $offset MINUTE)";
    350358        }
     
    429437
    430438            foreach ( array_filter( $aggregate ) as $function ) {
     439                $distinct = false;
    431440
    432441                if ( is_array( $function ) ) {
     
    437446                    $as          = isset( $function['as'] ) ? esc_sql( $function['as'] ) : strtolower( $function['function'] ) . '_' . $field;
    438447                    $query_field = isset( $function['expression'] ) ? $this->prepare_math_expression( $function['expression'], $field ) : $table_field;
     448                    $distinct    = ! empty( $function['distinct'] );
    439449                    $function    = $function['function'];
    440450                } else {
     
    449459                }
    450460
    451                 $this->query_fields[] = "$function_upper($query_field) AS $as";
     461                if ( $distinct ) {
     462                    $this->query_fields[] = "$function_upper(DISTINCT $query_field) AS $as";
     463                } else {
     464                    $this->query_fields[] = "$function_upper($query_field) AS $as";
     465                }   
    452466            }
    453467        }
    454468
    455469        // Prepare groupby fields.
    456         $timezone_offset = $this->get_mysql_timezone_offset();
     470        $timezone_offset = $this->get_mysql_timezone_offset( $qv );
    457471        if ( ! empty( $qv['groupby'] ) ) {
    458472            foreach ( wp_parse_list( $qv['groupby'] ) as $index => $field ) {
Note: See TracChangeset for help on using the changeset viewer.