Changeset 3449507
- Timestamp:
- 01/29/2026 11:02:25 AM (2 months ago)
- Location:
- hizzle-downloads
- Files:
-
- 12 edited
- 1 copied
-
tags/1.2.8 (copied) (copied from hizzle-downloads/trunk)
-
tags/1.2.8/hizzle-downloads.php (modified) (2 diffs)
-
tags/1.2.8/readme.txt (modified) (2 diffs)
-
tags/1.2.8/src/Download_Handler.php (modified) (7 diffs)
-
tags/1.2.8/vendor/composer/installed.json (modified) (3 diffs)
-
tags/1.2.8/vendor/composer/installed.php (modified) (3 diffs)
-
tags/1.2.8/vendor/hizzle/store/src/Query.php (modified) (4 diffs)
-
trunk/hizzle-downloads.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Download_Handler.php (modified) (7 diffs)
-
trunk/vendor/composer/installed.json (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (3 diffs)
-
trunk/vendor/hizzle/store/src/Query.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hizzle-downloads/tags/1.2.8/hizzle-downloads.php
r3435015 r3449507 4 4 * Plugin URI: https://hizzle.co/download-manager/ 5 5 * Description: A lightweight download manager plugin. 6 * Version: 1.2. 76 * Version: 1.2.8 7 7 * Author: Hizzle 8 8 * Author URI: https://hizzle.co … … 22 22 23 23 if ( ! defined( 'HIZZLE_DOWNLOADS_VERSION' ) ) { 24 define( 'HIZZLE_DOWNLOADS_VERSION', '1.2. 7' );24 define( 'HIZZLE_DOWNLOADS_VERSION', '1.2.8' ); 25 25 } 26 26 -
hizzle-downloads/tags/1.2.8/readme.txt
r3435015 r3449507 5 5 Tested up to: 6.9 6 6 Requires PHP: 5.6 7 Version: 1.2. 78 Stable tag: 1.2. 77 Version: 1.2.8 8 Stable tag: 1.2.8 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 132 132 == Changelog == 133 133 134 = 1.2.8 = 135 - Update composer packages. 136 134 137 = 1.2.7 = 135 138 - Update composer packages. -
hizzle-downloads/tags/1.2.8/src/Download_Handler.php
r2908611 r3449507 45 45 // Abort if the file doesn't exist. 46 46 if ( is_wp_error( $file ) ) { 47 return $this->download_error( $file );47 return $this->download_error( $file, 404 ); 48 48 } 49 49 50 50 // Abort if the file is not downloadable. 51 51 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 ); 53 53 } 54 54 55 55 // Check if the current user can download the file. 56 56 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 ); 58 58 } 59 59 … … 67 67 68 68 try { 69 $download_range = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged69 $download_range = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 70 70 71 71 // Track the download. … … 82 82 } catch ( \Exception $e ) { 83 83 $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 ); 85 85 } 86 86 … … 103 103 // Check the password. 104 104 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 } 108 110 } 109 111 … … 198 200 do_action( 'hizzle_download_file_redirect', $file ); 199 201 } else { 200 self::download_error( __( 'File not found', 'hizzle-downloads' ) );202 self::download_error( __( 'File not found', 'hizzle-downloads' ), 404 ); 201 203 } 202 204 } … … 451 453 * @param \WP_Error $error The error to display. 452 454 */ 453 private function download_error( $error ) {455 private function download_error( $error, $code = 400 ) { 454 456 455 457 /* … … 466 468 } 467 469 468 wp_die( $error, 400); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped470 wp_die( $error, $code ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 469 471 } 470 472 -
hizzle-downloads/tags/1.2.8/vendor/composer/installed.json
r3435015 r3449507 54 54 { 55 55 "name": "hizzle/store", 56 "version": "0.2.1 7",57 "version_normalized": "0.2.1 7.0",56 "version": "0.2.18", 57 "version_normalized": "0.2.18.0", 58 58 "source": { 59 59 "type": "git", 60 60 "url": "https://github.com/hizzle-co/datastore.git", 61 "reference": " 1b867f0c029c87431ccfb9c76821f868d1d63875"61 "reference": "a01cea3f0018b11500c4748cbc410c2d362291c2" 62 62 }, 63 63 "dist": { 64 64 "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", 67 67 "shasum": "" 68 68 }, … … 70 70 "php": ">=5.3.0" 71 71 }, 72 "time": "2026-01- 08T09:55:37+00:00",72 "time": "2026-01-26T15:11:28+00:00", 73 73 "type": "library", 74 74 "installation-source": "dist", … … 99 99 "support": { 100 100 "issues": "https://github.com/hizzle-co/datastore/issues", 101 "source": "https://github.com/hizzle-co/datastore/tree/0.2.1 7"101 "source": "https://github.com/hizzle-co/datastore/tree/0.2.18" 102 102 }, 103 103 "install-path": "../hizzle/store" -
hizzle-downloads/tags/1.2.8/vendor/composer/installed.php
r3435015 r3449507 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',6 'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',16 'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', … … 30 30 ), 31 31 'hizzle/store' => array( 32 'pretty_version' => '0.2.1 7',33 'version' => '0.2.1 7.0',34 'reference' => ' 1b867f0c029c87431ccfb9c76821f868d1d63875',32 'pretty_version' => '0.2.18', 33 'version' => '0.2.18.0', 34 'reference' => 'a01cea3f0018b11500c4748cbc410c2d362291c2', 35 35 'type' => 'library', 36 36 'install_path' => __DIR__ . '/../hizzle/store', -
hizzle-downloads/tags/1.2.8/vendor/hizzle/store/src/Query.php
r3435015 r3449507 340 340 } 341 341 342 private function get_mysql_timezone_offset() { 342 /** 343 * @param array $qv The query vars. 344 */ 345 private function get_mysql_timezone_offset( $qv ) { 343 346 $offset = get_option( 'gmt_offset', 0 ); 344 347 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 } 347 354 348 355 if ( 0 > $offset ) { 356 $offset = abs( $offset ); 349 357 return "DATE_SUB(%s, INTERVAL $offset MINUTE)"; 350 358 } … … 429 437 430 438 foreach ( array_filter( $aggregate ) as $function ) { 439 $distinct = false; 431 440 432 441 if ( is_array( $function ) ) { … … 437 446 $as = isset( $function['as'] ) ? esc_sql( $function['as'] ) : strtolower( $function['function'] ) . '_' . $field; 438 447 $query_field = isset( $function['expression'] ) ? $this->prepare_math_expression( $function['expression'], $field ) : $table_field; 448 $distinct = ! empty( $function['distinct'] ); 439 449 $function = $function['function']; 440 450 } else { … … 449 459 } 450 460 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 } 452 466 } 453 467 } 454 468 455 469 // Prepare groupby fields. 456 $timezone_offset = $this->get_mysql_timezone_offset( );470 $timezone_offset = $this->get_mysql_timezone_offset( $qv ); 457 471 if ( ! empty( $qv['groupby'] ) ) { 458 472 foreach ( wp_parse_list( $qv['groupby'] ) as $index => $field ) { -
hizzle-downloads/trunk/hizzle-downloads.php
r3435015 r3449507 4 4 * Plugin URI: https://hizzle.co/download-manager/ 5 5 * Description: A lightweight download manager plugin. 6 * Version: 1.2. 76 * Version: 1.2.8 7 7 * Author: Hizzle 8 8 * Author URI: https://hizzle.co … … 22 22 23 23 if ( ! defined( 'HIZZLE_DOWNLOADS_VERSION' ) ) { 24 define( 'HIZZLE_DOWNLOADS_VERSION', '1.2. 7' );24 define( 'HIZZLE_DOWNLOADS_VERSION', '1.2.8' ); 25 25 } 26 26 -
hizzle-downloads/trunk/readme.txt
r3435015 r3449507 5 5 Tested up to: 6.9 6 6 Requires PHP: 5.6 7 Version: 1.2. 78 Stable tag: 1.2. 77 Version: 1.2.8 8 Stable tag: 1.2.8 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 132 132 == Changelog == 133 133 134 = 1.2.8 = 135 - Update composer packages. 136 134 137 = 1.2.7 = 135 138 - Update composer packages. -
hizzle-downloads/trunk/src/Download_Handler.php
r2908611 r3449507 45 45 // Abort if the file doesn't exist. 46 46 if ( is_wp_error( $file ) ) { 47 return $this->download_error( $file );47 return $this->download_error( $file, 404 ); 48 48 } 49 49 50 50 // Abort if the file is not downloadable. 51 51 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 ); 53 53 } 54 54 55 55 // Check if the current user can download the file. 56 56 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 ); 58 58 } 59 59 … … 67 67 68 68 try { 69 $download_range = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged69 $download_range = self::get_download_range( @filesize( $parsed_file_path['file_path'] ) ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 70 70 71 71 // Track the download. … … 82 82 } catch ( \Exception $e ) { 83 83 $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 ); 85 85 } 86 86 … … 103 103 // Check the password. 104 104 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 } 108 110 } 109 111 … … 198 200 do_action( 'hizzle_download_file_redirect', $file ); 199 201 } else { 200 self::download_error( __( 'File not found', 'hizzle-downloads' ) );202 self::download_error( __( 'File not found', 'hizzle-downloads' ), 404 ); 201 203 } 202 204 } … … 451 453 * @param \WP_Error $error The error to display. 452 454 */ 453 private function download_error( $error ) {455 private function download_error( $error, $code = 400 ) { 454 456 455 457 /* … … 466 468 } 467 469 468 wp_die( $error, 400); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped470 wp_die( $error, $code ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 469 471 } 470 472 -
hizzle-downloads/trunk/vendor/composer/installed.json
r3435015 r3449507 54 54 { 55 55 "name": "hizzle/store", 56 "version": "0.2.1 7",57 "version_normalized": "0.2.1 7.0",56 "version": "0.2.18", 57 "version_normalized": "0.2.18.0", 58 58 "source": { 59 59 "type": "git", 60 60 "url": "https://github.com/hizzle-co/datastore.git", 61 "reference": " 1b867f0c029c87431ccfb9c76821f868d1d63875"61 "reference": "a01cea3f0018b11500c4748cbc410c2d362291c2" 62 62 }, 63 63 "dist": { 64 64 "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", 67 67 "shasum": "" 68 68 }, … … 70 70 "php": ">=5.3.0" 71 71 }, 72 "time": "2026-01- 08T09:55:37+00:00",72 "time": "2026-01-26T15:11:28+00:00", 73 73 "type": "library", 74 74 "installation-source": "dist", … … 99 99 "support": { 100 100 "issues": "https://github.com/hizzle-co/datastore/issues", 101 "source": "https://github.com/hizzle-co/datastore/tree/0.2.1 7"101 "source": "https://github.com/hizzle-co/datastore/tree/0.2.18" 102 102 }, 103 103 "install-path": "../hizzle/store" -
hizzle-downloads/trunk/vendor/composer/installed.php
r3435015 r3449507 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',6 'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' dfebdbe0fa191a0a76e5e45e018f0fd6f59ac1dd',16 'reference' => 'bd2ed913f507a2af118fe4b0885c8b66578f59fd', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', … … 30 30 ), 31 31 'hizzle/store' => array( 32 'pretty_version' => '0.2.1 7',33 'version' => '0.2.1 7.0',34 'reference' => ' 1b867f0c029c87431ccfb9c76821f868d1d63875',32 'pretty_version' => '0.2.18', 33 'version' => '0.2.18.0', 34 'reference' => 'a01cea3f0018b11500c4748cbc410c2d362291c2', 35 35 'type' => 'library', 36 36 'install_path' => __DIR__ . '/../hizzle/store', -
hizzle-downloads/trunk/vendor/hizzle/store/src/Query.php
r3435015 r3449507 340 340 } 341 341 342 private function get_mysql_timezone_offset() { 342 /** 343 * @param array $qv The query vars. 344 */ 345 private function get_mysql_timezone_offset( $qv ) { 343 346 $offset = get_option( 'gmt_offset', 0 ); 344 347 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 } 347 354 348 355 if ( 0 > $offset ) { 356 $offset = abs( $offset ); 349 357 return "DATE_SUB(%s, INTERVAL $offset MINUTE)"; 350 358 } … … 429 437 430 438 foreach ( array_filter( $aggregate ) as $function ) { 439 $distinct = false; 431 440 432 441 if ( is_array( $function ) ) { … … 437 446 $as = isset( $function['as'] ) ? esc_sql( $function['as'] ) : strtolower( $function['function'] ) . '_' . $field; 438 447 $query_field = isset( $function['expression'] ) ? $this->prepare_math_expression( $function['expression'], $field ) : $table_field; 448 $distinct = ! empty( $function['distinct'] ); 439 449 $function = $function['function']; 440 450 } else { … … 449 459 } 450 460 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 } 452 466 } 453 467 } 454 468 455 469 // Prepare groupby fields. 456 $timezone_offset = $this->get_mysql_timezone_offset( );470 $timezone_offset = $this->get_mysql_timezone_offset( $qv ); 457 471 if ( ! empty( $qv['groupby'] ) ) { 458 472 foreach ( wp_parse_list( $qv['groupby'] ) as $index => $field ) {
Note: See TracChangeset
for help on using the changeset viewer.