Ejemplo n.º 1
0
 $pagination_length = 15;
 $pagination_start = isset($_GET['page']) ? $_GET['page'] * $pagination_length : 0;
 $ecommerce = new ImCart();
 // Clean the temp files
 $ecommerce->deleteTemporaryFiles("../");
 if ($ecommerce->setDatabaseConnection($dbconf['host'], $dbconf['user'], $dbconf['password'], $dbconf['database'], $prefix)) {
     if (isset($_GET['id'])) {
         if (isset($_GET['evade'])) {
             $ecommerce->evadeOrder($_GET['id']);
             header('Location: order.php?id=' . $_GET['id']);
             exit;
         }
         if (isset($_GET['exportcsv'])) {
             ob_end_clean();
             // Clear the output buffer
             $zip = $ecommerce->zipOrder($_GET['id'], "../");
             if (false !== $zip) {
                 header('Content-Description: File Transfer');
                 header('Content-Type: application/octet-stream');
                 header('Content-Disposition: attachment; filename=' . substr(basename($zip), 0, strlen(basename($zip)) - 4) . ".zip");
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate');
                 header('Pragma: public');
                 header('Content-Length: ' . readfile($zip));
                 // Read the file and automatically output it to the output buffer, return the file size
                 exit;
             }
             // As fallback, export the products csv only
             $csv = $ecommerce->getProductsCSV($_GET['id']);
             header('Content-Description: File Transfer');
             header('Content-Type: application/octet-stream');