Jump to content

Darth Ryô

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Darth Ryô

  1. Ok, for PHP Version => 5.5.23

    So no upgrade needed.

     

    Then I tried the above code change (commented out the Error define lines and added the constants lines).

    Well, now the link works but just send me to the page HOME / YOUR ACCOUNT / DIGITAL DOWNLOADS

    with an error message (see attached picture):

    The following errors were detected:

    • It has not been possible to locate the download file.

     

    Aside of the warnings already mentioned before, there is no new PHP Fatal error in the error.log

     

    Again, I've tried that 3 time with the same results:

    - Uploaded file

    - Custom path on server

    - Custom path toward a file on internet (http link)

     

    If you look at the attached screenshot, the name of the target file is however properly displayed to the user... so it can somehow see the target but unable to download it (each download attempt just refreshes the page and error message).

     

    Thanks again!

     

     

    Capture.JPG

  2. Hello,

     

    Alright, turned the error logging on.

    [10-Apr-2015 17:11:35 Europe/London] PHP Fatal error:  Undefined class constant 'FM_DL_ERROR_NOFILE' in /home/darthryo/public_html/goth-3designs/classes/filemanager.class.php on line 397
    [10-Apr-2015 17:14:21 Europe/London] PHP Fatal error:  Undefined class constant 'FM_DL_ERROR_NOFILE' in /home/darthryo/public_html/goth-3designs/classes/filemanager.class.php on line 397
    [10-Apr-2015 17:21:18 Europe/London] PHP Warning:  array_merge() [<a href='http://docs.php.net/manual/en/function.array-merge.php'>function.array-merge.php</a>]: Argument #2 is not an array in /home/darthryo/public_html/goth-3designs/admin/sources/products.index.inc.php on line 1266
    [10-Apr-2015 17:21:18 Europe/London] PHP Warning:  natcasesort() expects parameter 1 to be array, null given in /home/darthryo/public_html/goth-3designs/admin/sources/products.index.inc.php on line 1269
    [10-Apr-2015 17:21:18 Europe/London] PHP Warning:  Invalid argument supplied for foreach() in /home/darthryo/public_html/goth-3designs/admin/sources/products.index.inc.php on line 1270
    [10-Apr-2015 17:21:51 Europe/London] PHP Warning:  Invalid argument supplied for foreach() in /home/darthryo/public_html/goth-3designs/classes/ajax.class.php on line 130
    [10-Apr-2015 17:21:55 Europe/London] PHP Warning:  array_merge() [<a href='http://docs.php.net/manual/en/function.array-merge.php'>function.array-merge.php</a>]: Argument #2 is not an array in /home/darthryo/public_html/goth-3designs/admin/sources/products.index.inc.php on line 1266
    [10-Apr-2015 17:21:55 Europe/London] PHP Warning:  natcasesort() expects parameter 1 to be array, null given in /home/darthryo/public_html/goth-3designs/admin/sources/products.index.inc.php on line 1269
    [10-Apr-2015 17:21:55 Europe/London] PHP Warning:  Invalid argument supplied for foreach() in /home/darthryo/public_html/goth-3designs/admin/sources/products.index.inc.php on line 1270
    [10-Apr-2015 17:23:51 Europe/London] PHP Fatal error:  Undefined class constant 'FM_DL_ERROR_NOFILE' in /home/darthryo/public_html/goth-3designs/classes/filemanager.class.php on line 397

    The lines in red correspond to when I click on the digital download link sent by mail.

    First 2 lines are on a product with a custom path on my server, the last one is o a product with a file uploaded in Cubecart directly.

    (I guess the other warning are not critical...)

     

    See below the extract of my filemanager.class.php (in red the line 397 mentioned in the log).

    Unfortunately this is really not my area of expertise and I don't understand the issue.

     

    Thanks again for your help :)

     

                                  

        /**
         * Deliver download file
         *
         * @param string $access_key
         * @param string $error
         * @return bool
         */
        public function deliverDownload($access_key = false, &$error = null) {
            if ($this->_mode == self::FM_FILETYPE_DL && $access_key) {
                if (($downloads = $GLOBALS['db']->select('CubeCart_downloads', false, array('accesskey' => $access_key))) !== false) {
                    $download = $downloads[0];
                    if (($summary = $GLOBALS['db']->select('CubeCart_order_summary', false, array('cart_order_id' => $download['cart_order_id']))) !== false) {
                        // Order/Download Validation
                        // Download has expired
                        if ($download['expire']>0 && $download['expire'] < time())  $error = self::FM_DL_ERROR_EXPIRED;
                        // Order hasn't been paid for
                        if (!in_array((int)$summary[0]['status'], array(2, 3)))     $error = self::FM_DL_ERROR_PAYMENT;
                        // Maximum download limit has been reached
                        if ($GLOBALS['config']->get('config', 'download_count') > 0 && (int)$download['downloads'] >= $GLOBALS['config']->get('config', 'download_count')) $error = self::FM_DL_ERROR_MAXDL;
                        if (!empty($error)) return false;
                        if ($data = $this->getFileInfo($download['product_id']) !== false) {


                            // Deliver file contents
                            if (isset($data['file']) && ($data['is_url'] || file_exists($data['file']))) {
                                if ($is_url) {
                                    $GLOBALS['db']->update('CubeCart_downloads', array('downloads' => $download['downloads']+1), array('digital_id' => $download['digital_id']));
                                    httpredir($file);
                                    return true;
                                } else {
                                    ob_end_clean();
                                    if (!is_file($file) or connection_status()!=0) return false;

                                    header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
                                    header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
                                    header('Content-Disposition: attachment; filename="'.basename($file).'"');
                                    header("Content-Type: application/octet-stream");
                                    header("Content-Transfer-Encoding: binary");
                                    ## IE 7 Fix
                                    header('Vary: User-Agent');

                                    if (($openfile = fopen($file, 'rb')) !== false) {
                                        while (!feof($openfile)) {
                                            set_time_limit(120);
                                            echo fread($openfile, 8192);
                                            flush();
                                        }
                                        fclose($openfile);
                                    }
                                    if (!connection_status() && !connection_aborted()) {
                                        $GLOBALS['db']->update('CubeCart_downloads', array('downloads' => $download['downloads']+1), array('digital_id' => $download['digital_id']));
                                        return true;
                                    }
                                }
                            }
                            ## File doesn't exist
                            $error = self::FM_DL_ERROR_NOFILE;
                            return false;
                        }
                        ## Product record doesn't exist
                        $error = self::FM_DL_ERROR_NOPRODUCT;
                        return false;
                    }
                }
                // Download record doesn't exist
                $error = self::FM_DL_ERROR_NORECORD;
            }
            return false;
        }

  3. Hello!

     

    I've just installed CubeCart V6 on a new Subdomain (nothing else installed on this subdomain).

    Everything seem to be working fine, except that I can't get the download link to work for digital purchase (100% of my shop will be digital files).

     

    Apparently, I'm getting a 500 internal error when I click on the link generated after the purchase (sent by mail) or in the customer Digital Download section.

     

    And this happens wherever the file location is  :errm:

    I've tried with an uploaded file, a custom path leading to a directory /home/username/folder/filename, as well as a link to an externally hosted file (http link)... nothing

     

    I'm a bit lost right now, I don't know what's wrong (I'd have expected at least the http link file to work since the file isn't hosted on my server... but not even that).

    It's seems the generated link is the problem...

     

    Any help would be greatly appreciated!

     

    Thanks a lot in advance

    DR

×
×
  • Create New...