Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help With NONSSL And SSL Pages


gaspower

Recommended Posts

Hello,

 

I am using OSC 2.31 and the below code is a box that displays a Paypal logo that links to them. I need on SSL pages this box or the paypal logo not to show. The Paypal data is on here in the code:

 

$data = '<BR/><div align="center"><script type="text/javascript">document.write(\'<scr\');document.write(\'ipt type="text/javascript" data-ppmnid="10847" src="//ad.where.com/jin/spotlight/ads?pubid=05698f&format=js&v=2.4&placementtype=120x240&ppmnid=10847&rand=\' + Math.round(Math.random() * 100000000000000) + \'">\');document.write(\'</scr\' + \'ipt>\');</script></div>';

 

Complete file code:

<?php
/*
$Id$
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2010 osCommerce
Released under the GNU General Public License
*/
class bm_paypal {
var $code = 'bm_paypal';
var $group = 'boxes';
var $title;
var $description;
var $sort_order;
var $enabled = false;
function bm_paypal() {
 $this->title = MODULE_BOXES_PAYPAL_TITLE;
 $this->description = MODULE_BOXES_PAYPAL_DESCRIPTION;
 if ( defined('MODULE_BOXES_PAYPAL_STATUS') ) {
 $this->sort_order = MODULE_BOXES_PAYPAL_SORT_ORDER;
 $this->enabled = (MODULE_BOXES_PAYPAL_STATUS == 'True');
 $this->group = ((MODULE_BOXES_PAYPAL_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
 }
}
// BOF MTS
function dataF() {
 $data = '<BR/><div align="center"><script type="text/javascript">document.write(\'<scr\');document.write(\'ipt type="text/javascript" data-ppmnid="10847" src="//ad.where.com/jin/spotlight/ads?pubid=05698f&format=js&v=2.4&placementtype=120x240&ppmnid=10847&rand=\' + Math.round(Math.random() * 100000000000000) + \'">\');document.write(\'</scr\' + \'ipt>\');</script></div>';

return $data;
}
function execute() {
 global $oscTemplate;
 $oscTemplate->addBlock($this->dataF(), $this->group);
}
// EOF MTS
function isEnabled() {
 return $this->enabled;
}
function check() {
 return defined('MODULE_BOXES_PAYPAL_STATUS');
}
function install() {
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Paypal Module', 'MODULE_BOXES_PAYPAL_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_PAYPAL_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
 tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_PAYPAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
}
function remove() {
 tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
 return array('MODULE_BOXES_PAYPAL_STATUS', 'MODULE_BOXES_PAYPAL_CONTENT_PLACEMENT', 'MODULE_BOXES_PAYPAL_SORT_ORDER');
}
}
?>

 

Thank you JR

Link to comment
Share on other sites

Hi

 

Looking at

function dataF() {
	 $data = '<BR/><div align="center"><script type="text/javascript">document.write(\'<scr\');document.write(\'ipt type="text/javascript" data-ppmnid="10847" src="//ad.where.com/jin/spotlight/ads?pubid=05698f&format=js&v=2.4&placementtype=120x240&ppmnid=10847&rand=\' + Math.round(Math.random() * 100000000000000) + \'">\');document.write(\'</scr\' + \'ipt>\');</script></div>';

return $data;
}

 

Sounds like you may be getting an insecure content warning in SSL pages - you could try changing

src="//ad.where.com/jin/spotlight/ads?pubid=05698f&format=js&v=2.4&placementtype=120x240&ppmnid=10847&rand=\' + Math.round(Math.random() * 100000000000000) + \'"

 

to

 

src="https://ad.where.com/jin/spotlight/ads?pubid=05698f&format=js&v=2.4&placementtype=120x240&ppmnid=10847&rand=\' + Math.round(Math.random() * 100000000000000) + \'"

 

or if asking for the image over ssl does not work then

 



function dataF() {
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
$data='';
}else{
//original code here
$data = '<BR/><div align="center"><script type="text/javascript">document.write(\'<scr\');document.write(\'ipt type="text/javascript" data-ppmnid="10847" src="//ad.where.com/jin/spotlight/ads?pubid=05698f&format=js&v=2.4&placementtype=120x240&ppmnid=10847&rand=\' + Math.round(Math.random() * 100000000000000) + \'">\');document.write(\'</scr\' + \'ipt>\');</script></div>';
//end original
}

return $data;
}

 

That's off the top of my head so I've not tested it

Link to comment
Share on other sites

Was able to get this solved, changed these lines in the bm box file located in /includes/modules/boxes.

 

Change this line to:

$oscTemplate->addBlock($data, $this->group);

 

To this:

if ( $request_type == 'NONSSL' ) {
			 $oscTemplate->addBlock($data, $this->group);
	 }

 

Also change this line:

global $oscTemplate;

 

To this:

global $oscTemplate, $request_type;

JR

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...