download.php File Reference
Go to the source code of this file.
Functions
- tep_random_name ()
- tep_unlink_temp_dir ($dir)
Variables
- if((isset($_GET['order'])&&!is_numeric($_GET['order']))||(isset($_GET['id'])&&!is_numeric($_GET['id']))) $downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . $customer_id . "' and o.orders_id = '" . (int)$_GET['order'] . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '" . (int)$_GET['id'] . "' and opd.orders_products_filename != ''")
- $downloads = tep_db_fetch_array($downloads_query)
- $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year)
Detailed Description
Definition in file download.php.
Function Documentation
| tep_random_name | ( | ) |
Definition at line 46 of file download.php.
| tep_unlink_temp_dir | ( | $ | dir | ) |
Definition at line 60 of file download.php.
00061 { 00062 $h1 = opendir($dir); 00063 while ($subdir = readdir($h1)) { 00064 // Ignore non directories 00065 if (!is_dir($dir . $subdir)) continue; 00066 // Ignore . and .. and CVS 00067 if ($subdir == '.' || $subdir == '..' || $subdir == 'CVS') continue; 00068 // Loop and unlink files in subdirectory 00069 $h2 = opendir($dir . $subdir); 00070 while ($file = readdir($h2)) { 00071 if ($file == '.' || $file == '..') continue; 00072 @unlink($dir . $subdir . '/' . $file); 00073 } 00074 closedir($h2); 00075 @rmdir($dir . $subdir); 00076 } 00077 closedir($h1); 00078 } 00079 00080 00081 // Now send the file with header() magic 00082 header("Expires: Mon, 26 Nov 1962 00:00:00 GMT"); 00083 header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT"); 00084 header("Cache-Control: no-cache, must-revalidate"); 00085 header("Pragma: no-cache"); 00086 header("Content-Type: Application/octet-stream"); 00087 header("Content-disposition: attachment; filename=" . $downloads['orders_products_filename']); 00088 00089 if (_cst_bool('DOWNLOAD_BY_REDIRECT')) { 00090 // This will work only on Unix/Linux hosts 00091 tep_unlink_temp_dir(DIR_FS_DOWNLOAD_PUBLIC); 00092 $tempdir = tep_random_name(); 00093 umask(0000); 00094 mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777); 00095 symlink(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']); 00096 tep_redirect(DIR_WS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']); 00097 } else {
Variable Documentation
| $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year) |
Definition at line 31 of file download.php.
| $downloads = tep_db_fetch_array($downloads_query) |
Definition at line 28 of file download.php.
| if ((isset($_GET['order'])&&!is_numeric($_GET['order']))||(isset($_GET['id'])&&!is_numeric($_GET['id']))) $downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . $customer_id . "' and o.orders_id = '" . (int)$_GET['order'] . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '" . (int)$_GET['id'] . "' and opd.orders_products_filename != ''") |
Definition at line 26 of file download.php.
