ubercart криво отдает файлы -in_array() expects parameter 2

Главные вкладки

Аватар пользователя boroda-da boroda-da 15 декабря 2015 в 21:02

Ошибка отданных файлов уберкарт 2 под друпал6
in_array() expects parameter 2 to be array, boolean given в файле
/sites/all/modules/ubercart/uc_file/uc_file.pages.inc в строке 365.

* Processes a file download.
*/
function _uc_file_log_download($file_user, $ip) {

// Add the address if it doesn't exist.
$addresses = $file_user->addresses;

if (!in_array($ip, $addresses)) {

$addresses[] = $ip;
}

После прохождения оплаты, дается ссылка на скачивание архива,
после качивания архива - пишет архив поврежден (zip)
отдельно архив проверяю - нормальный
Кто боролся с такой бедой?

Комментарии

Аватар пользователя boroda-da boroda-da 17 декабря 2015 в 1:38

Поможет ли такой патч?

diff --git a/uc_file/uc_file.pages.inc b/uc_file/uc_file.pages.inc
index ff5d32e..2595ba9 100644
--- a/uc_file/uc_file.pages.inc
+++ b/uc_file/uc_file.pages.inc
@@ -200,7 +200,12 @@ function _uc_file_download($fid) {
);

$ip = ip_address();
- $file_download = uc_file_get_by_uid($user->uid, $fid);
+ if (user_access('view all downloads')) {
+ $file_download = uc_file_get_by_id($fid);
+ }
+ else {
+ $file_download = uc_file_get_by_uid($user->uid, $fid);
+ }

if (isset($file_download->filename)) {
$file_download->full_path = uc_file_qualify_file($file_download->filename);
@@ -210,7 +215,10 @@ function _uc_file_download($fid) {
}

// If it's ok, we push the file to the user.
- $status = _uc_file_download_validate($file_download, $user, $ip);
+ $status = UC_FILE_ERROR_OK;
+ if (!user_access('view all downloads')) {
+ $status = _uc_file_download_validate($file_download, $user, $ip);
+ }
if ($status == UC_FILE_ERROR_OK) {
_uc_file_download_transfer($file_download, $ip);
}