<tr valign="top"> <th scope="row"> <?php submit_button(); ?> </th> <td></td> </tr> </tbody> </table> </form> <div id="debug-debug_data" class="pane"> <table class="form-table"> <tbody> <?php if (Cart66Log::exists()) { ?> <tr valign="top"> <th scope="row"><?php _e('Error Log', 'cart66'); ?> </th> <td> <form action="" method="post" style="display:inline-block"> <input type="hidden" name="cart66-action" value="download log file" id="download-log-file" /> <input type="submit" value="<?php _e('Download Log File', 'cart66'); ?> " class="button-secondary" /> </form> <form action="" method="post" style="display:inline-block">
public static function saveSettings() { $error = ''; foreach ($_REQUEST as $key => $value) { if ($key[0] != '_' && $key != 'action' && $key != 'submit' && $key) { if (is_array($value) && $key != 'admin_page_roles') { $value = array_filter($value, 'strlen'); if (empty($value)) { $value = ''; } else { $value = implode('~', $value); } } if ($key == 'status_options') { $value = str_replace('&', '', Cart66Common::deepTagClean($value)); } if ($key == 'home_country') { $hc = Cart66Setting::getValue('home_country'); if ($hc != $value) { $method = new Cart66ShippingMethod(); $method->clearAllLiveRates(); } } elseif ($key == 'countries') { if (strpos($value, '~') === false) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] country list value: {$value}"); $value = ''; } if (empty($value) && !empty($_REQUEST['international_sales'])) { $error = "Please select at least one country to ship to."; } } elseif ($key == 'enable_logging' && $value == '1') { try { Cart66Log::createLogFile(); } catch (Cart66Exception $e) { $error = '<span>' . $e->getMessage() . '</span>'; Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Caught Cart66 exception: " . $e->getMessage()); } } elseif ($key == 'constantcontact_list_ids') { } elseif ($key == 'admin_page_roles') { $value = serialize($value); Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Saving Admin Page Roles: " . print_r($value, true)); } elseif ($key == 'currency_decimals' && $value == 0) { $value = 'no_decimal'; } Cart66Setting::setValue($key, trim(stripslashes($value))); if (CART66_PRO && $key == 'order_number') { $versionInfo = get_transient('_cart66_version_request'); if (!$versionInfo) { $versionInfo = Cart66ProCommon::getVersionInfo(); set_transient('_cart66_version_request', $versionInfo, 43200); } if (!$versionInfo) { Cart66Setting::setValue('order_number', ''); $error = '<span>' . __('Invalid Order Number', 'cart66') . '</span>'; } } } } if ($error) { $result[0] = 'Cart66Modal alert-message alert-error'; $result[1] = "<strong>" . __("Warning", "cart66") . "</strong><br/>{$error}"; } else { $result[0] = 'Cart66Modal alert-message success'; $result[1] = '<strong>Success</strong><br/>' . $_REQUEST['_success'] . '<br>'; } $out = json_encode($result); echo $out; die; }
/** * Force downloads for * -- Cart66 reports (admin) * -- Downloading the debuggin log file (admin) * -- Downloading digital product files */ public function forceDownload() { ob_end_clean(); if ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'export_csv') { require_once CART66_PATH . "/models/Cart66Exporter.php"; $start = str_replace(';', '', $_POST['start_date']); $end = str_replace(';', '', $_POST['end_date']); Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Date parameters for report: START {$start} and END {$end}"); $report = Cart66Exporter::exportOrders($start, $end); header('Content-Type: application/csv'); header('Content-Disposition: inline; filename="Cart66Report.csv"'); echo $report; die; } elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'download log file') { $logFilePath = Cart66Log::getLogFilePath(); if (file_exists($logFilePath)) { $logData = file_get_contents($logFilePath); $cartSettings = Cart66Log::getCartSettings(); header('Content-Description: File Transfer'); header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename=Cart66LogFile.txt'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo $cartSettings . "\n\n"; echo $logData; die; } } elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && Cart66Common::postVal('cart66-action') == 'clear log file') { Cart66Common::clearLog(); } }