Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
datazen committed Apr 18, 2015
2 parents 00d9043 + aab4bd8 commit 3ae245a
Show file tree
Hide file tree
Showing 37 changed files with 215 additions and 85 deletions.
16 changes: 8 additions & 8 deletions catalog/admin/includes/application_top.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@
require_once('external/vqmod/vqmod.php');
$lC_Vqmod = new VQMod();

// compatibility work-around logic
require($lC_Vqmod->modCheck('../includes/functions/compatibility.php'));
require($lC_Vqmod->modCheck('includes/functions/compatibility.php'));

// set the type of request (secure or not)
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
if ($request_type == 'NONSSL') {
define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
} else {
$request_type = getRequestType();
if ($request_type == 'https') {
define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
} else {
define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
}
define('API_VERSION', '1_0');

if (!defined('DIR_WS_ADMIN')) define('DIR_WS_ADMIN', 'admin/');
if (!defined('DIR_FS_ADMIN')) define('DIR_FS_ADMIN', DIR_FS_CATALOG . 'admin/');

// compatibility work-around logic for PHP4
require($lC_Vqmod->modCheck('../includes/functions/compatibility.php'));
require($lC_Vqmod->modCheck('includes/functions/compatibility.php'));

// include the list of project filenames
require($lC_Vqmod->modCheck('includes/filenames.php'));

Expand Down
4 changes: 2 additions & 2 deletions catalog/admin/includes/applications/login/classes/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public static function validateSerial($serial) {
$validateArr['checksum'] = $checksum;

$api_version = (defined('API_VERSION') && API_VERSION != NULL) ? API_VERSION : '1_0';
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();
$resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/check/serial/', 'method' => 'post', 'parameters' => $validateArr, 'timeout' => 10));
$resultArr = utility::xml2arr($resultXML);

Expand Down Expand Up @@ -255,7 +255,7 @@ public static function validateSerial($serial) {
*/
public static function apiCheck() {
$api_version = (defined('API_VERSION') && API_VERSION != NULL) ? API_VERSION : '1_0';
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();
$apiCheck = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
$versions = utility::xml2arr($apiCheck);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function getProductsListingPrice($data) {

$Qspecials->freeResult();

if(DISPLAY_PRICE_WITH_TAX == 1) {
if(DISPLAY_PRICE_WITH_TAX == 1 || $_SESSION['localization']['show_tax'] == 1) {
$tax_data = lC_Tax_classes_Admin::getEntry($data['products_tax_class_id']);
$price = ($data['products_price'] + ($tax_data['tax_rate']/100)*$data['products_price']);
$price = $lC_Currencies->format($price, DECIMAL_PLACES);
Expand Down Expand Up @@ -623,7 +623,7 @@ public static function get($id) {
}
$Qoptions->freeResult();

if (DISPLAY_PRICE_WITH_TAX == 1) {
if (DISPLAY_PRICE_WITH_TAX == 1 || $_SESSION['localization']['show_tax'] == 1) {
$tax_data = lC_Tax_classes_Admin::getEntry($data['products_tax_class_id']);
$data['products_price_with_tax'] = ($data['products_price'] + ($tax_data['tax_rate']/100)*$data['products_price']);
//$data['products_cost_with_tax'] = $data['products_cost'] + ($tax_data['tax_rate']/100)*$data['products_cost'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<span class="mid-margin-left no-margin-right strong"><?php echo $lC_Currencies->getSymbolLeft(); ?></span>
<?php
if (isset($pInfo)) {
if(DISPLAY_PRICE_WITH_TAX == 1) {
if(DISPLAY_PRICE_WITH_TAX == 1 || $_SESSION['localization']['show_tax'] == 1) {
$products_price_gross = lc_round($pInfo->get('products_price_with_tax'), DECIMAL_PLACES);
} else {
$products_price_gross = lc_round($pInfo->get('products_price'), DECIMAL_PLACES);
Expand Down
6 changes: 3 additions & 3 deletions catalog/admin/includes/applications/store/classes/store.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static function getAllTypes() {
$request['checksum'] = $checksum;

$api_version = (defined('API_VERSION') && API_VERSION != NULL) ? API_VERSION : '1_0';
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();
$resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/store/types/?ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'post', 'parameters' => $request, 'timeout' => 10));

$types = utility::xml2arr($resultXML);
Expand All @@ -277,7 +277,7 @@ public static function getAvailbleAddons() {
$request['checksum'] = $checksum;
$request['instID'] = INSTALLATION_ID;

$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();
$api_version = (defined('API_VERSION') && API_VERSION != NULL) ? API_VERSION : '1_0';
$resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/store/addons/?ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'post', 'parameters' => $request, 'timeout' => 10));

Expand Down Expand Up @@ -585,7 +585,7 @@ public static function getAddonPhar($key, $type = 'addon') {
$pubkey = file_get_contents(DIR_FS_WORK . 'addons/update.phar.pubkey');
file_put_contents(DIR_FS_WORK . 'addons/' . $key . '.phar.pubkey', $pubkey);

$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();
$response = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . $key . '?type=addon&ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']), 'method' => 'get', 'timeout' => 10));

if (strlen($response) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static function getAvailablePackages() {

$result = array('entries' => array());
$api_version = (defined('API_VERSION') && API_VERSION != NULL) ? API_VERSION : '1_0';
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();
$versions = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
$versions_array = utility::xml2arr($versions);

Expand Down Expand Up @@ -194,7 +194,7 @@ public static function downloadPackage($version = null, $type = null) {
}
}
$api_version = (defined('API_VERSION') && API_VERSION != NULL) ? API_VERSION : '1_0';
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();
if ($link == null) $link = $request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . str_replace(".", "", $version) . '?ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']);
if ($type != null) $link .= '&type=' . $type;

Expand Down
2 changes: 1 addition & 1 deletion catalog/admin/includes/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private function _doRegister($data) {

$api_version = (defined('API_VERSION') && API_VERSION != NULL) ? API_VERSION : '1_0';
$registerArr['ver'] = utility::getVersion();
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'https' : 'http';
$request_type = getRequestType();

$resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/register/install/', 'method' => 'post', 'parameters' => $registerArr, 'timeout' => 10));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @package admin::languages::modules
# @author Loaded Commerce
# @copyright Copyright 2003-2014 Loaded Commerce, LLC
# @copyright Portions Copyright 2003 osCommerce
# @license https://github.com/loadedcommerce/loaded7/blob/master/LICENSE.txt
# @version $Id: cache.php v1.0 2013-08-08 datazen $

services_cache_title = Cache
services_cache_description = Cache for faster operation
38 changes: 38 additions & 0 deletions catalog/admin/includes/modules/services/cache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
@package admin::modules
@author Loaded Commerce
@copyright Copyright 2003-2014 Loaded Commerce, LLC
@copyright Portions Copyright 2003 osCommerce
@license https://github.com/loadedcommerce/loaded7/blob/master/LICENSE.txt
@version $Id: cache.php v1.0 2013-08-08 datazen $
*/
class lC_Services_cache_Admin {
var $title,
$description,
$uninstallable = true,
$depends,
$precedes;

public function lC_Services_cache_Admin() {
global $lC_Language;

$lC_Language->loadIniFile('modules/services/cache.php');

$this->title = $lC_Language->get('services_cache_title');
$this->description = $lC_Language->get('services_cache_description');
}

public function install() {
return false;
}

public function remove() {
return false;
}

public function keys() {
return false;
}
}
?>
8 changes: 4 additions & 4 deletions catalog/ext/jquery/ckeditor/ck_upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
include_once('../../../includes/config.php');

// set the type of request (https or http)
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';
if ($request_type == 'NONSSL') {
define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
} else {
$request_type = getRequestType();
if ($request_type == 'https') {
define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
} else {
define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
}

if(isset($_GET['CKEditor']) && !empty($_GET['CKEditor']) ){
Expand Down
19 changes: 10 additions & 9 deletions catalog/includes/application_top.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@
// virtual hook system
require_once(DIR_FS_CATALOG . 'ext/vqmod/vqmod.php');
$lC_Vqmod = new VQMod();

// set the type of request (secure or not)
$request_type = (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on')) ? 'SSL' : 'NONSSL';

if ($request_type == 'NONSSL') {
define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
} else {
// compatibility work-around logic
require($lC_Vqmod->modCheck(DIR_FS_CATALOG . 'includes/functions/compatibility.php'));

// set the type of request (secure or not)
$request_type = getRequestType();
if ($request_type == 'https') {
define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
} else {
define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
}
define('API_VERSION', '1_0');

// compatibility work-around logic for PHP4
require($lC_Vqmod->modCheck(DIR_FS_CATALOG . 'includes/functions/compatibility.php'));

// include the list of project filenames
require($lC_Vqmod->modCheck(DIR_FS_CATALOG . 'includes/filenames.php'));

Expand Down Expand Up @@ -102,4 +101,6 @@
// instantiate the addons class
require_once($lC_Vqmod->modCheck(DIR_FS_CATALOG . 'includes/classes/addons.php'));
$lC_Addons = new lC_Addons();

setLocalization();
?>
15 changes: 13 additions & 2 deletions catalog/includes/classes/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ class lC_Cache {
*/

private $_key;

/**
* Return cache service status
*
* @var boolean
* @access public
*/

public function isEnabled() {
return (defined('MODULE_SERVICES_INSTALLED') && in_array('cache', explode(';', MODULE_SERVICES_INSTALLED))) ? true : false;
}

/**
* Write the data to a cache file
Expand All @@ -44,7 +55,7 @@ public function write($data, $key = null) {
if ( empty($key) ) {
$key = $this->_key;
}

return ( @file_put_contents(DIR_FS_WORK . 'cache/' . $key . '.cache', serialize($data), LOCK_EX) !== false );
}

Expand All @@ -58,7 +69,7 @@ public function write($data, $key = null) {
*/

public function read($key, $expire = null) {
$this->_key = $key;
$this->_key = $key;

$filename = DIR_FS_WORK . 'cache/' . $key . '.cache';

Expand Down
4 changes: 2 additions & 2 deletions catalog/includes/classes/category_tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct() {
$this->_show_total_products = true;
}

if ( $lC_Cache->read('category_tree-' . $lC_Language->getCode(), 720) ) {
if ( $lC_Cache->isEnabled() && $lC_Cache->read('category_tree-' . $lC_Language->getCode(), 720) ) {
$this->_data = $lC_Cache->getCache();
} else {
$Qcategories = $lC_Database->query('select c.categories_id, c.categories_image, c.parent_id, c.categories_mode, c.categories_link_target, c.categories_custom_url, c.categories_status, c.categories_visibility_nav, c.categories_visibility_box, c.access_levels, cd.categories_name, cd.categories_menu_name from :table_categories c, :table_categories_description cd where c.categories_status = 1 and c.categories_id = cd.categories_id and cd.language_id = :language_id');
Expand Down Expand Up @@ -127,7 +127,7 @@ public function __construct() {
$this->_data = $catArr;
}

$lC_Cache->write($this->_data);
if ($lC_Cache->isEnabled()) $lC_Cache->write($this->_data);
}
}

Expand Down
6 changes: 3 additions & 3 deletions catalog/includes/classes/currencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function addTaxRateToPrice($price, $tax_rate, $quantity = 1) {
$price = $this->santizePrice($price);
$price = lc_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']);

if ( (DISPLAY_PRICE_WITH_TAX == '1') && ($tax_rate > 0) ) {
if ( (DISPLAY_PRICE_WITH_TAX == '1' || $_SESSION['localization']['show_tax'] == 1) && ($tax_rate > 0) ) {
$price += lc_round($price * ($tax_rate / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']);
}
return lc_round($price * $quantity, $this->currencies[DEFAULT_CURRENCY]['decimal_places']);
Expand All @@ -74,7 +74,7 @@ public function displayPrice($price, $tax_class_id, $quantity = 1, $currency_cod
$price = $this->santizePrice($price);
$price = lc_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']);

if ( (DISPLAY_PRICE_WITH_TAX == '1') && ($tax_class_id > 0) ) {
if ( (DISPLAY_PRICE_WITH_TAX == '1' || $_SESSION['localization']['show_tax'] == 1) && ($tax_class_id > 0) ) {
$price += lc_round($price * ($lC_Tax->getTaxRate($tax_class_id) / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']);
}

Expand All @@ -86,7 +86,7 @@ public function displayPriceWithTaxRate($price, $tax_rate, $quantity = 1, $force
$price = $this->santizePrice($price);
$price = lc_round($price, $this->currencies[DEFAULT_CURRENCY]['decimal_places']);

if ( (($force === true) || (DISPLAY_PRICE_WITH_TAX == '1')) && ($tax_rate > 0) ) {
if ( (($force === true) || (DISPLAY_PRICE_WITH_TAX == '1' || $_SESSION['localization']['show_tax'] == 1)) && ($tax_rate > 0) ) {
$price += lc_round($price * ($tax_rate / 100), $this->currencies[DEFAULT_CURRENCY]['decimal_places']);
}
return $this->format($price * $quantity, $currency_code, $currency_value);
Expand Down
6 changes: 3 additions & 3 deletions catalog/includes/classes/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public function freeResult() {
$this->db_class->freeResult($this->query_handler);
}

if (isset($this->cache_key)) {
if ($lC_Cache->isEnabled() && isset($this->cache_key)) {
$lC_Cache->write($this->cache_data, $this->cache_key);
}
}
Expand Down Expand Up @@ -516,14 +516,14 @@ public function affectedRows() {
public function execute() {
global $lC_Cache;

if (isset($this->cache_key)) {
if ($lC_Cache->isEnabled() && isset($this->cache_key)) {
if ($lC_Cache->read($this->cache_key, $this->cache_expire)) {
$this->cache_data = $lC_Cache->getCache();

$this->cache_read = true;
}
}

if ($this->cache_read === false) {
if ($this->logging === true) {
$this->logging_action = substr($this->sql_query, 0, strpos($this->sql_query, ' '));
Expand Down
10 changes: 5 additions & 5 deletions catalog/includes/classes/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public function __construct($group) {

$this->_group = $group;

// if ($lC_Cache->read('templates_' . $this->_group . '_layout-' . $lC_Template->getCode() . '-' . $lC_Template->getGroup() . '-' . $lC_Template->getPageContentsFilename())) {
// $data = $lC_Cache->getCache();
// } else {
if ($lC_Cache->isEnabled() && ($lC_Cache->read('templates_' . $this->_group . '_layout-' . $lC_Template->getCode() . '-' . $lC_Template->getGroup() . '-' . $lC_Template->getPageContentsFilename()))) {
$data = $lC_Cache->getCache();
} else {
$data = array();

$Qspecific = $lC_Database->query('select b2p.boxes_group, b.code from :table_templates_boxes_to_pages b2p, :table_templates_boxes b, :table_templates t where b2p.templates_id = :templates_id and b2p.page_specific = 1 and b2p.content_page in (:content_page) and b2p.templates_boxes_id = b.id and b.modules_group = :modules_group and b2p.templates_id = t.id order by b2p.boxes_group, b2p.sort_order');
Expand Down Expand Up @@ -79,9 +79,9 @@ public function __construct($group) {
$data[$groups][] = $module['code'];
}
}
// }
}

$lC_Cache->write($data);
if ($lC_Cache->isEnabled()) $lC_Cache->write($data);
}

$this->_modules = $data;
Expand Down
Loading

0 comments on commit 3ae245a

Please sign in to comment.