Exemple #1
0
 /**
  * Generates the output for the exported report
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return void
  **/
 public function output()
 {
     if (empty($this->data)) {
         Shopp::redirect(add_query_arg(array_merge($_GET, array('src' => null)), admin_url('admin.php')));
     }
     $sitename = get_bloginfo('name');
     $report = $this->options['report'];
     $reports = ShoppAdminReport::reports();
     $name = $reports[$report]['name'];
     header("Content-type: {$this->content_type}");
     header("Content-Disposition: attachment; filename=\"{$sitename} {$name}.{$this->extension}\"");
     header("Content-Description: Delivered by " . ShoppVersion::agent());
     header("Cache-Control: maxage=1");
     header("Pragma: public");
     $this->begin();
     if ($this->headings) {
         $this->heading();
     }
     $this->records();
     $this->end();
 }
Exemple #2
0
 /**
  * Setup configurable constants
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return void
  **/
 public function constants()
 {
     if (!defined('SHOPP_VERSION')) {
         define('SHOPP_VERSION', ShoppVersion::release());
     }
     if (!defined('SHOPP_GATEWAY_USERAGENT')) {
         define('SHOPP_GATEWAY_USERAGENT', ShoppVersion::agent());
     }
     // @deprecated
     if (!defined('SHOPP_HOME')) {
         define('SHOPP_HOME', ShoppSupport::HOMEPAGE);
     }
     if (!defined('SHOPP_CUSTOMERS')) {
         define('SHOPP_CUSTOMERS', ShoppSupport::FORUMS);
     }
     if (!defined('SHOPP_DOCS')) {
         define('SHOPP_DOCS', ShoppSupport::DOCS);
     }
     // Helper for line break output
     if (!defined('BR')) {
         define('BR', '<br />');
     }
     // Overrideable config macros
     if (!defined('SHOPP_NOSSL')) {
         define('SHOPP_NOSSL', false);
     }
     // Require SSL to protect transactions, overrideable for development
     if (!defined('SHOPP_PREPAYMENT_DOWNLOADS')) {
         define('SHOPP_PREPAYMENT_DOWNLOADS', false);
     }
     // Require payment capture granting access to downloads
     if (!defined('SHOPP_SESSION_TIMEOUT')) {
         define('SHOPP_SESSION_TIMEOUT', 172800);
     }
     // Sessions live for 2 days
     if (!defined('SHOPP_CART_EXPIRES')) {
         define('SHOPP_CART_EXPIRES', 1209600);
     }
     // Carts are stashed for up to 2 weeks
     if (!defined('SHOPP_QUERY_DEBUG')) {
         define('SHOPP_QUERY_DEBUG', false);
     }
     // Debugging queries is disabled by default
     if (!defined('SHOPP_GATEWAY_TIMEOUT')) {
         define('SHOPP_GATEWAY_TIMEOUT', 10);
     }
     // Gateway connections timeout after 10 seconds
     if (!defined('SHOPP_SHIPPING_TIMEOUT')) {
         define('SHOPP_SHIPPING_TIMEOUT', 10);
     }
     // Shipping provider connections timeout after 10 seconds
     if (!defined('SHOPP_SUBMIT_TIMEOUT')) {
         define('SHOPP_SUBMIT_TIMEOUT', 20);
     }
     // Order submission timeout
     if (!defined('SHOPP_TEMP_PATH')) {
         define('SHOPP_TEMP_PATH', sys_get_temp_dir());
     }
     // Use the system defined temporary directory
     if (!defined('SHOPP_ADDONS')) {
         define('SHOPP_ADDONS', WP_CONTENT_DIR . '/shopp-addons');
     }
     // A configurable directory to keep Shopp addons
     if (!defined('SHOPP_NAMESPACE_TAXONOMIES')) {
         define('SHOPP_NAMESPACE_TAXONOMIES', true);
     }
     // Add taxonomy namespacing for permalinks /shop/category/category-name, /shopp/tag/tag-name
 }
Exemple #3
0
 public function download($dkey = false)
 {
     $found = $this->found();
     if (!$found) {
         return shopp_add_error(Shopp::__('Download failed. &quot;%s&quot; could not be found.', $this->name), 'false');
     }
     add_action('shopp_download_success', array($this, 'downloaded'));
     // send immediately if the storage engine is redirecting
     if (isset($found['redirect'])) {
         $this->send();
         exit;
     }
     // Close the session in case of long download
     @session_write_close();
     // Don't want interference from the server
     if (function_exists('apache_setenv')) {
         @apache_setenv('no-gzip', 1);
     }
     @ini_set('zlib.output_compression', 0);
     set_time_limit(0);
     // Don't timeout on long downloads
     // Use HTTP/1.0 Expires to support bad browsers (trivia: timestamp used is the Shopp 1.0 release date)
     header('Expires: ' . date('D, d M Y H:i:s O', 1230648947));
     header('Cache-Control: maxage=0, no-cache, must-revalidate');
     header('Content-type: application/octet-stream');
     header("Content-Transfer-Encoding: binary");
     header('Content-Disposition: attachment; filename="' . $this->name . '"');
     header('Content-Description: Delivered by ' . ShoppVersion::agent());
     ignore_user_abort(true);
     if (ob_get_length() !== false) {
         while (@ob_end_flush()) {
         }
     }
     // Clear all open output buffers
     $this->send();
     // Send the file data using the storage engine
     flush();
     // Flush output to browser (to poll for connection)
     if (connection_aborted()) {
         return shopp_add_error(Shopp::__('Connection broken. Download attempt failed.'), SHOPP_COMM_ERR);
     }
     return true;
 }
Exemple #4
0
 public function output()
 {
     if (!$this->data) {
         $this->query();
     }
     if (!$this->data) {
         Shopp::redirect(add_query_arg(array_merge($_GET, array('src' => null)), admin_url('admin.php')));
     }
     header("Content-type: {$this->content_type}; charset=UTF-8");
     header("Content-Disposition: attachment; filename=\"{$this->sitename} Purchase Log.{$this->extension}\"");
     header("Content-Description: Delivered by " . ShoppVersion::agent());
     header("Cache-Control: maxage=1");
     header("Pragma: public");
     $this->begin();
     if ($this->headings) {
         $this->heading();
     }
     $this->records();
     $this->end();
 }
 public function output()
 {
     if (!$this->data) {
         $this->query();
     }
     if (!$this->data) {
         return false;
     }
     header("Content-type: {$this->content_type}; charset=UTF-8");
     header("Content-Disposition: attachment; filename=\"{$this->sitename} Customer Export.{$this->extension}\"");
     header("Content-Description: Delivered by " . ShoppVersion::agent());
     header("Cache-Control: maxage=1");
     header("Pragma: public");
     $this->begin();
     if ($this->headings) {
         $this->heading();
     }
     $this->records();
     $this->end();
 }