HEX
Server: Apache/2.4.25 (Debian)
System: Linux server17 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User: web37 (1062)
PHP: 7.4.30
Disabled: show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, disk_total_space, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen
Upload Files
File: /var/www/web37/htdocs/lovetalk/admin/cart-order.php
<?php 

require_once "includes.php";

Configuration::getControlPanel()->accessOrRedirect();

// Load the cart
$ecommerce = Configuration::getCart();
$ecommerce->deleteTemporaryFiles("../");

// Load the main template
$mainT = Configuration::getControlPanel()->getMainTemplate();
$mainT->stylesheets = array("css/cart.css");
$mainT->pagetitle = l10n("cart_title", "E-Commerce");
$contentT = new Template("templates/common/box.php");
$contentT->cssClass = "cart";
$contentT->content = "";

// Add the table tabs
$tabsT = new Template("templates/cart/tabs.php");
$tabsT->borderColorClass = "border-mute";
$tabsT->selectedBgColorClass = "background-color-mute";
$tabsT->unselectedBgColorClass = "background-mute";
$tabsT->status = '';
$contentT->content .= $tabsT->render();

if (isset($_GET['id'])) {

	// Evade the order
	if (isset($_GET['evade'])) {
		$ecommerce->evadeOrder($_GET['id']);
		header('Location: cart-order.php?id=' . $_GET['id']);
		exit();
	}

	// Export the CSV file
	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');
	    header('Content-Disposition: attachment; filename=' . $_GET['id'] . ".csv");
	    header('Expires: 0');
	    header('Cache-Control: must-revalidate');
	    header('Pragma: public');
	    header('Content-Length: ' . strlen($csv));
	    echo $csv;
	    exit();
	}

	// Show the order table
	$orderArray = $ecommerce->getOrder($_GET['id']);
	if (count($orderArray)) {
		$orderT = new Template("templates/cart/order.php");
		$orderT->order = $orderArray['order'];
		$orderT->orderArray = $orderArray;
		$contentT->content .= $orderT->render();
	}
}

$mainT->content = $contentT->render();

echo $mainT->render();