Created
March 10, 2011 02:15
-
-
Save loxK/863446 to your computer and use it in GitHub Desktop.
Allows unlimited files downloads for wp-e-commerce 3.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: wpsc-includes/ajax.functions.php | |
=================================================================== | |
--- wpsc-includes/ajax.functions.php (révision 357938) | |
+++ wpsc-includes/ajax.functions.php (copie de travail) | |
@@ -958,10 +958,10 @@ | |
// strip out anything that isnt 'a' to 'z' or '0' to '9' | |
ini_set('max_execution_time',10800); | |
$downloadid = preg_replace( "/[^a-z0-9]+/i", '', strtolower( $_GET['downloadid'] ) ); | |
- $download_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `uniqueid` = '" . $downloadid . "' AND `downloads` > '0' AND `active`='1' LIMIT 1", ARRAY_A ); | |
+ $download_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `uniqueid` = '" . $downloadid . "' AND (`downloads` > '0' OR `downloads` < '0') AND `active`='1' LIMIT 1", ARRAY_A ); | |
if ( ($download_data == null) && is_numeric( $downloadid ) ) { | |
- $download_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `id` = '" . $downloadid . "' AND `downloads` > '0' AND `active`='1' AND `uniqueid` IS NULL LIMIT 1", ARRAY_A ); | |
+ $download_data = $wpdb->get_row( "SELECT * FROM `" . WPSC_TABLE_DOWNLOAD_STATUS . "` WHERE `id` = '" . $downloadid . "' AND (`downloads` > '0' OR `downloads` < '0') AND `uniqueid` IS NULL LIMIT 1", ARRAY_A ); | |
} | |
if ( (get_option( 'wpsc_ip_lock_downloads' ) == 1) && ($_SERVER['REMOTE_ADDR'] != null) ) { | |
@@ -998,7 +998,7 @@ | |
if ( (int)$download_data['downloads'] >= 1 ) { | |
$download_count = (int)$download_data['downloads'] - 1; | |
} else { | |
- $download_count = 0; | |
+ $download_count = (int)$download_data['downloads']; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment