Hallo,
ich möchte teilweise Downloads von anderen Webspaces zulassen, also nicht nur vom Verzeichnis "download" innerhalb des Gambio-Shops. Meine Idee war, diese mit kompletter URL in die Tabelle products_attributes_download zu schreiben. Wegen dem Pfadbeginn
http://www. kann ich dann ja eindeutig unterscheiden, was von einer externen Quelle kommt, und was nicht. Ich habe jetzt in zwei Dateien was geändert (siehe unten).
Allerdings funktioniert die
Prüfung (file_exists) in der Datei includes/modules/downloads.php nicht, deshalb bin ich bei einer externen Download-Quelle davon ausgegangen, dass die Datei existiert. Der Rote Pfeil zum Download erscheint, aber wenn ich dann drauf klicke, passiert nichts, ich bekomme einen weißen Bildschirm.
Danke für jeden Hinweis!
1. account_history_info.php: Wo $filepath vorkommt, habe ich den normalen Zusammenbau des Dateinamens und -pfades ersetzt, durch diese
Prüfung.
PHP-Code:
// Die if file is not there
$filepath = $downloads['orders_products_filename'];
$pos = strpos($filepath, "www.");
$exists = 1; // keine Prüfung auf Existieren bei externer Quelle,
// warum funktioniert die Prüfung da nicht? Gibt immer false zurück.
if ($pos === false) {
$filepath = DIR_FS_DOWNLOAD.$filepath;
if (!file_exists($filepath)) {
$exists = 0;
}
}
if ($exists == 0) {}
else
{
2. includes/modules/download.phps: Wo $filepath vorkommt, habe ich den normalen Zusammenbau des Dateinamens und -pfades ersetzt.
PHP-Code:
// The link will appear only if:
// - Download remaining count is > 0, AND
// - The file is present in the DOWNLOAD directory, AND EITHER
// - No expiry date is enforced (maxdays == 0), OR
// - The expiry date is not reached
$filepath = $downloads['orders_products_filename'];
$pos = strpos($filepath, "www.");
$exists = true; // keine Prüfung auf Existieren bei externer Quelle,
// warum funktioniert die Prüfung da nicht? Gibt immer false zurück.
if ($pos === false) {
$filepath = DIR_FS_DOWNLOAD.$filepath;
$exists = file_exists($filepath);
}
if (($downloads['download_count'] > 0) && $exists && (($downloads['download_maxdays'] == 0) ||
($download_timestamp > time())) && ($order_status >= DOWNLOAD_MIN_ORDERS_STATUS)) {
$dl[$jj]['download_link'] = '<a href="'.xtc_href_link(FILENAME_DOWNLOAD,
'order='.$last_order.'&id='.$downloads['orders_products_download_id']).
'">'.$downloads['products_name'].'</a>';
$dl[$jj]['pic_link'] = xtc_href_link(FILENAME_DOWNLOAD, 'order='.$last_order.'&id='.
$downloads['orders_products_download_id']);
} else {
$dl[$jj]['download_link'] = $downloads['products_name'];
}
//<!-- right box -->
$dl[$jj]['date'] = xtc_date_long($download_expiry);
$dl[$jj]['count'] = $downloads['download_count'];
$jj ++;
}
}