Latest News: (loading..)
Sign in to follow this  
Followers 0
web-project

LoginRadius for osCommerce v2.2

7 posts in this topic

Hi all,

 

I have used the original LoginRadius module for osCommerce v2.3:

http://addons.oscommerce.com/info/8306

 

Known issues:

- after click on social netwok icon, I am getting the following error:

Warning: Cannot modify header information - headers already sent by (output started at /catalogue/index.php:56) in /catalogue/includes/functions/general.php on line 33

- loging and create account page still under development (I can share code but the code is not function properly)

 

the code for LoginRadius for osCommerce v2.2:

 

sql need to load in to mysql database:

insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Information Module', 'MODULE_BOXES_LOGINRADIUS_STATUS', 'True', 'Do you want to add the module to your shop?', '1', '510', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('LoginRadius API Key', 'MODULE_BOXES_LOGINRADIUS_API_KEY', '0', 'Paste LoginRadius API Key here', '1', '511', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('LoginRadius API Secret', 'MODULE_BOXES_LOGINRADIUS_API_SECRET_KEY', '0', 'Paste LoginRadius API Secret here', '1', '512', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Email Required', 'MODULE_BOXES_LOGINRADIUS_EMAIL_REQUIRED', 'True', 'Is Email Required?', '1', '513', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Title', 'MODULE_BOXES_LOGINRADIUS_TITLE', 'Social Login', 'Enter the Module Title of your choice', '1', '514', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Text on Login page', 'MODULE_BOXES_LOGINRADIUS_LOGINTEXT', 'You do not have to create a new account, login with your existing account using any of the following Providers:', 'Enter the text which you want to be appeared on Login page', '1', '515', now());
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Text on Registration page', 'MODULE_BOXES_LOGINRADIUS_ACCTEXT', 'You do not have to create a new account, login with your existing account using any of the following Providers:', 'Enter the text which you want to be appeared on Registration page', '1', '516', now());

 

/catalogue/includes/boxes/bm_loginradius.php code

<?php
require(DIR_WS_CLASSES . 'loginradius.php');

  global $cart,$navigation,$messageStack,$breadcrumb,$session_started,$customer_id,$customer_first_name,$customer_default_address_id,$customer_country_id,$customer_zone_id,$password,$confirm,$id,$provider,$profilename,$fullname,$email_address,$firstname,$lastname;
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
define('FILENAME_CREATE_ACCOUNT', 'create_account.php');
 $language='english';
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);
  if ( $session_started == false ) {
		  tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
	}
 //for adding extra field
function add_column_if_not_exist($db, $column, $column_attr = "varchar( 255 ) NULL" ) {
	$exists = false;
	$columns = mysql_query("show columns from $db");
	while($c = mysql_fetch_assoc($columns)) {
		if($c['Field'] == $column){
			$exists = true;
			break;
		}
	}	
	if( !$exists ) {
		mysql_query("ALTER TABLE `$db` ADD `$column`  $column_attr");
	}
}
function popup($FirstName,$LastName,$id,$Provider,$ProfileName,$FullName,$msg) {?>
<style type="text/css">
.LoginRadius_overlay
{
background: none no-repeat scroll 0 0 rgba(127, 127, 127, 0.6);
position: absolute;
top: 0;
left: 0;
z-index: 100001;
width: 100%;
height: 100%;
overflow: auto;
padding: 220px 20px 20px 20px;
padding-bottom: 130px;
position: fixed;
}
#popupouter{
-moz-border-radius:4px;
-webkit-border-radius:4px;
border-radius:4px;
overflow:auto;
background:#f3f3f3;
padding:0px 0px 0px 0px;
width:370px;
margin:0 auto;
}
#popupinner{
-moz-border-radius:4px;
-webkit-border-radius:4px;
border-radius:4px;
overflow:auto;
background:#ffffff;
margin:10px;
padding:10px 8px 4px 8px;
}
#textmatter{
margin:10px 0px 10px 0px;
font-family:Arial, Helvetica, sans-serif;
color:#666666;
font-size:14px;
}
.inputtxt{
font-family:Arial, Helvetica, sans-serif;
color:#a8a8a8;
font-size:11px;
border:#e5e5e5 1px solid;
width:280px;
height:27px;
margin:5px 0px 15px 0px;
}
.inputbutton{
border:#dcdcdc 1px solid;
-moz-border-radius:2px;
-webkit-border-radius:2px;
border-radius:2px;
text-decoration:none;
color:#6e6e6e;
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
cursor:pointer;
background:#f3f3f3;
padding:6px 7px 6px 8px;
margin:0px 8px 0px 0px;

}
.inputbutton:hover{
border:#00ccff 1px solid;
-moz-border-radius:2px;
-webkit-border-radius:2px;
border-radius:2px;
khtml-border-radius:2px;
text-decoration:none;
color:#000000;
font-family:Arial, Helvetica, sans-serif;
font-size:13px;
cursor:pointer;
padding:6px 7px 6px 8px;
-moz-box-shadow: 0px 0px  4px #8a8a8a;
-webkit-box-shadow: 0px 0px  4px #8a8a8a;
box-shadow: 0px 0px  4px #8a8a8a;
background:#f3f3f3;
margin:0px 8px 0px 0px;
}
#textdiv{
text-align:right;
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
color:#000000;
}
.span{
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
color:#00ccff;
}
.span1{
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
color:#333333;
}
.LoginRadius_container_outer {
width: 648px;
border: 1px solid #ccc;
background-color: #EAF7FF;
}
.LoginRadius_container_inner {
background-color: #EAF7FF;
padding: 10px;
margin-bottom: 10px;
overflow: hidden;
width: 140px;
}
.LoginRadius_container {
float:left;
padding: 10px;
margin-bottom: 10px;
overflow: hidden;
width:460px;
background-color: #EAF7FF;
}
.LoginRadius_container_outer h3 {
color:#00ccff;
font-size:1.1em;
}
.LoginRadius_container_outer ul {
list-style-type: disc;
padding-left: 20px;
}

.LoginRadius_container_outer .LoginRadius_container_links {
border-color: #E6DB55;
}
.LoginRadius_container_outer .LoginRadius_container_links a {
color: #111;
text-decoration:none;
}
.LoginRadius_container_outer .LoginRadius_container_links a:hover {
color: #00ccff;
}
.LoginRadius_table {
background-color: #efefef;
border: 1px solid #ccc;
width: 650px;
margin-bottom: 10px;
}
.LoginRadius_table input {
border-color: #aaa;
}
.LoginRadius_table .head {
font-weight: bold;
font-size: 13px;
font-weight: bold;
background-color: #ddd;
}
.LoginRadius_table tr td.row {
line-height: 36px;
}
.LoginRadius_table tr.description td {
color: #0D5995;
}
.LoginRadius_table .row_white {
background-color: #fff;
}

<!--[if IE]>
.LoginRadius_content_IE
{
background:black;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
filter: alpha(opacity=90);
}
<![endif]-->
</style>
<div id="fade" class="LoginRadius_overlay" class="LoginRadius_content_IE">
<div id="popupouter">
 <div id="popupinner">
<div id="textmatter"><?php if($msg){echo "<b>".$msg."</b>";}?></div>
<form><div>
<input type="text" name="email" id="email" class="inputtxt" /></div><div>
<input type="submit" id="LoginRadiusRedSliderClick" name="LoginRadiusRedSliderClick" value="Submit" class="inputbutton">
<input type="submit" value="cancel" class="inputbutton" onClick="history.back()" />
<input type="hidden" name="firstname" value="<?php echo $FirstName;?>" />
<input type="hidden" name="lastname" value="<?php echo $LastName;?>" />
<input type="hidden" name="id" value="<?php echo $id;?>"/>
<input type="hidden" name="provider" value="<?php echo $Provider;?>"/>
<input type="hidden" name="profilename" value="<?php echo $ProfileName;?>"/>
<input type="hidden" name="fullname"  value="<?php echo $FullName;?>"/>
</div></form><div id="textdiv">Poweredby <span class="span">Login</span><span class="span1">Radius</span></div>
 </div></div></div>
<?php }
function is_valid_email($email) {
 $result = TRUE;
 if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
$result = FALSE;
 }
 return $result;
}
$db='customers';
$column='loginradiusid';
add_column_if_not_exist($db, $column, $column_attr = "varchar( 255 ) NULL" );
//until here
$apikey_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_BOXES_LOGINRADIUS_API_KEY'");
$apikey_array = tep_db_fetch_array($apikey_query);
$apikey = $apikey_array['configuration_value'];
$apisecretkey_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_BOXES_LOGINRADIUS_API_SECRET_KEY'");
$apisecretkey_array = tep_db_fetch_array($apisecretkey_query);
$apisecretkey = $apisecretkey_array['configuration_value'];
$emailrequired_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_BOXES_LOGINRADIUS_EMAIL_REQUIRED'");
$emailrequired_array = tep_db_fetch_array($emailrequired_query);
$emailrequired = $emailrequired_array['configuration_value'];
//until here
if(isset($_SERVER['HTTPS'])) {
 $loc = urlencode("https://".$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
}
else {
 $loc=urlencode("http://".$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
}
			  if(tep_session_is_registered('customer_id')) {
		   $data = '<div class="ui-widget infoBoxContainer">' .
			  '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGINRADIUS_BOX_TITLE . '</div>' .
			  '  <div class="ui-widget-content infoBoxContents">' . "Hello ". $customer_first_name .'!' . '</div>' .
			  '</div>';
  }
  else
  {
  if(isset($apikey)) {
				$obj_auth = new LoginRadiusAuth();
				   $UserAuth = $obj_auth->auth($apikey, $apisecretkey);
				$IsHttps=$UserAuth->IsHttps;
			if($IsHttps == 1) {
  $data = '<div class="ui-widget infoBoxContainer">' .
			  '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGINRADIUS_BOX_TITLE . '</div>' .
			  '  <div class="ui-widget-content infoBoxContents"><iframe src="https://hub.loginradius.com/Control/PluginSlider2.aspx?apikey='.$apikey.'&callback='.$loc.'" width="138" height="49" frameborder="0" scrolling="no"></iframe>
</div></div>';
}
else {
$data = '<div class="ui-widget infoBoxContainer">' .
			  '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGINRADIUS_BOX_TITLE . '</div>' .
			  '  <div class="ui-widget-content infoBoxContents"><iframe src="http://hub.loginradius.com/Control/PluginSlider2.aspx?apikey='.$apikey.'&callback='.$loc.'" width="138" height="49" frameborder="0" scrolling="no"></iframe>
</div></div>';
  }
}
  }

$obj = new LoginRadius();
$userprofile = $obj->construct($apisecretkey);
if( $obj->IsAuthenticated == true ) {
	$process = true;
	$id = $userprofile->ID;
 $Provider = $userprofile->Provider;
			 $FirstName = $userprofile->FirstName;
			 $LastName = $userprofile->LastName;
			 $FullName = $userprofile->FullName;
	$ProfileName = $userprofile->ProfileName;
 $password = mt_rand(8, 15);
			 $error = false;
 $Email = $userprofile->Email[0]->Value;
if($Email == "" && $emailrequired == 'True') {
$check_existId = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where loginradiusid = '" . mysql_real_escape_string($id) . "'");
$check_customer = tep_db_fetch_array($check_existId);
if($check_customer > 0 && $check_customer != '')
{
   $customer_id = $check_customer['customers_id'];
 $customer_default_address_id = $check_customer['customers_default_address_id'];
   $customer_first_name = $check_customer['customers_firstname'];
 tep_session_register('customer_id');
	tep_session_register('customer_default_address_id');
	tep_session_register('customer_first_name');

tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");
$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
$cart->restore_contents();
$name = $FirstName . ' ' . $LastName;
if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
define('FILENAME_DEFAULT', 'index.php');
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
  }
   }
else {
$msg = "Please enter email to proceed.";
popup($FirstName,$LastName,$id,$Provider,$ProfileName,$FullName,$msg);
} }
}
if($_GET['email']) {
$check_existEmail = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . $_GET['email'] . "'");
$check_customer = tep_db_fetch_array($check_existEmail);
if($check_customer > 0  || !is_valid_email($_GET['email']))
{
$msg = "<p style='color:red;'><b>This email already registered or invalid. Please choose another one.</b></p>";
popup($FirstName,$LastName,$id,$Provider,$ProfileName,$FullName,$msg);
}
else {
$FirstName = $_GET['firstname'];
$LastName = $_GET['lastname'];
$Email = $_GET['email'];
$ProfileName = $_GET['profilename'];
$Provider = $_GET['provider'];
$id = $_GET['id'];
$FullName = $_GET['fullname'];
}
}
$Email_id=substr($id,7);
$Email_id2=str_replace("/","_",$Email_id);
switch( $Provider ){
 case 'facebook':
  $FirstName = $FirstName;
  $LastName = $LastName;
  $Email = $Email;
				 break;
	case 'twitter':
$FirstName=$ProfileName;
$LastName=$ProfileName;
 if ($emailrequired == 'True'){
 $Email=$Email;}
 else{
 $Email=$id.'@'.$Provider.'.com';}
 break;
	case 'google':
 $FirstName=$FirstName;
 $LastName=$LastName;
 $Email=$Email;
 break;
	case 'yahoo':
 $FirstName=$FirstName;
 $LastName=$LastName;
 $Email=$Email;
 break;
	case 'linkedin':
 $FirstName=$FirstName;
 $LastName=$LastName;
 if ($emailrequired == 'True'){
 $Email=$Email;}
 else{
 $Email = $id.'@'.$Provider.'.com';}
 break;
 case 'aol':
 $user_name=explode('@',$Email);
 $FirstName=$user_name[0];
 $LastName=$user_name[0];
 $Email=$Email;
		  break;
 case 'hyves':
 $FirstName=$FullName;
 $LastName=$FullName;
 $Email=$Email;
 break;
 default:
if($FirstName =='' && $LastName =='' && $FullName!='')
{ $FirstName = $FullName;}
if($FirstName =='' && $LastName =='' && $FullName=='' && $ProfileName!='')
   {$FirstName =$ProfileName;}
$Email_id=substr($id,7);
$Email_id2=str_replace("/","_",$Email_id);
if($FirstName =='' && $LastName =='' && $Email=='' && $id!='')
{
$username = $id;
$FirstName = $id;
$LastName = $id;
if ($emailrequired == 'True'){
 $Email=$Email;}
 else{
$Email = str_replace(".","_",$Email_id2).'@'.$Provider.'.com';}
}
 else if($FirstName != '' && $LastName !='' && $Email == '' && $id!=''){
 $FirstName =$FirstName;
 $LastName = $LastName;
 if ($emailrequired == 'True'){
 $Email=$Email;}
 else{
 $Email=str_replace(" ","_",$FirstName).'@'.$Provider.'.com';}
 }
 else if($FirstName =='' && $LastName =='' && $Email != ''){
   $user_name = explode('@',$Email);
   $FirstName =str_replace("_"," ",$user_name[0]);
   $LastName=str_replace("_"," ",$user_name[0]);
   $Email = $Email;
   }
   else if($LastName=='' && $FirstName !='' && $Email != ''){
   $FirstName = $FirstName;
   $LastName = $FirstName;
   $Email = $Email;
   }
	else {
	$FirstName = $FirstName;
	$LastName = $LastName;
	$Email = $Email;
	}
		   break;
		  }	
if( isset($id) && $Email !="")
{	
$check_existId = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where loginradiusid = '" . mysql_real_escape_string($id) . "'");
$check_customer = tep_db_fetch_array($check_existId);
if(!$check_customer && $check_customer == '')
{
$check_existEmail = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . $Email . "'");
$check_customer = tep_db_fetch_array($check_existEmail);
}
if($check_customer) {
	$customer_id = $check_customer['customers_id'];
 $customer_default_address_id = $check_customer['customers_default_address_id'];
	$customer_first_name = $check_customer['customers_firstname'];
 tep_session_register('customer_id');
	tep_session_register('customer_default_address_id');
	tep_session_register('customer_first_name');

tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");
$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
$cart->restore_contents();
$name = $FirstName . ' ' . $LastName;
if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
define('FILENAME_DEFAULT', 'index.php');
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
  }
   }

else {

define('FILENAME_COOKIE_USAGE', 'cookie_usage.php');
   define('FILENAME_LOGIN', 'login.php');
   define('FILENAME_ACCOUNT', 'account.php');
   define('FILENAME_ACCOUNT_EDIT', 'account_edit.php');
   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT);
   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_EDIT);
   require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);
				$sql_data_array = array('customers_firstname' => $FirstName,
						  'customers_lastname' => $LastName,
						  'customers_email_address' => $Email,
						  'loginradiusid' => mysql_real_escape_string($id),
						  'customers_password' => tep_encrypt_password($password));
	 tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

  $customer_id = tep_db_insert_id();
  $sql_data_array = array('customers_id' => $customer_id,
						  'entry_firstname' => $FirstName,
						  'entry_lastname' => $LastName,
						  'entry_country_id' => '0');
		tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

  $address_id = tep_db_insert_id();
 tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");
 tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");
if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }
   $customer_first_name = $FirstName;
$customer_default_address_id = $address_id;
   $customer_country_id = '0';
  tep_session_register('customer_id');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_first_name');
  $sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
  $cart->restore_contents();
  $name = $FirstName . ' ' . $LastName;
  $email_text = sprintf(EMAIL_GREET_NONE, $FirstName);
  $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
  tep_mail($name, $Email, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
  define('FILENAME_CREATE_ACCOUNT_SUCCESS', 'create_account_success.php');
  tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
  }
}
 if ($messageStack->size('create_account') > 0) {
echo $messageStack->output('create_account');
 }
?>
	  <tr>
		<td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'left',
						   'text'  => MODULE_BOXES_LOGINRADIUS_BOX_TITLE);
 new infoBoxHeading($info_box_contents, $newtheme, false, false);
 $loginboxcontent = "";
 $info_box_contents = array();
 $info_box_contents[] = array('align' => 'center',
						   'text'  => $data );
 new infoBox($info_box_contents);
?>
		</td>
	  </tr>

 

/catalogue/includes/classes/loginradius.php code

<?php
class LoginRadius {
 public $IsAuthenticated, $JsonResponse, $UserProfile;
 public function construct($ApiSecrete) {
$IsAuthenticated = false;
if (isset($_REQUEST['token'])) {
  $ValidateUrl = "http://hub.loginradius.com/userprofile.ashx?token=".$_REQUEST['token']."&apisecrete=".$ApiSecrete."";
  if (in_array('curl', get_loaded_extensions())) {
	$curl_handle = curl_init();
	curl_setopt($curl_handle, CURLOPT_URL, $ValidateUrl);
	curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
	curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, true);
	if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
	  curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
	  curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
	  $JsonResponse = curl_exec($curl_handle);
	}
	else {
	  curl_setopt($curl_handle, CURLOPT_HEADER, 1);
	  $url = curl_getinfo($curl_handle, CURLINFO_EFFECTIVE_URL);
	  curl_close($curl_handle);
	  $ch = curl_init();
	  $url = str_replace('?','/?',$url);
	  curl_setopt($ch, CURLOPT_URL, $url);
	  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	  $JsonResponse = curl_exec($ch);
	  curl_close($ch);
	}
	$UserProfile = json_decode($JsonResponse);
  }
  else if (ini_get('allow_url_fopen') == 1) {
	$JsonResponse = file_get_contents($ValidateUrl);
	$UserProfile = json_decode($JsonResponse);
  }
  else {
	echo "Please check php.ini settings<br><b>cURL support = enabled <br>or<br>allow_url_fopen = On</b>";
  }
  if (isset($UserProfile->ID) && $UserProfile->ID != ''){
	$this->IsAuthenticated = true;
	return $UserProfile;
  }
}
 }
}
class LoginRadiusAuth {
 public $IsAuth, $JsonResponse, $UserAuth;
 public function auth($ApiKey, $ApiSecrete){
$IsAuth = false;
if (isset($ApiKey)) {
  $ApiKey = trim($ApiKey);
  $ApiSecrete = trim($ApiSecrete);
  $ValidateUrl = "https://hub.loginradius.com/getappinfo/$ApiKey/$ApiSecrete";
  if (in_array('curl', get_loaded_extensions())) {
	$curl_handle = curl_init();
	curl_setopt($curl_handle, CURLOPT_URL, $ValidateUrl);
	curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
	curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, true);
	if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
	  curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
	  curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
	  $JsonResponse = curl_exec($curl_handle);
	}
	else {
	  curl_setopt($curl_handle, CURLOPT_HEADER, 1);
	  $url = curl_getinfo($curl_handle, CURLINFO_EFFECTIVE_URL);
	  curl_close($curl_handle);
	  $ch = curl_init();
	  $url = str_replace('?','/?',$url);
	  curl_setopt($ch, CURLOPT_URL, $url);
	  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	  $JsonResponse = curl_exec($ch);
	  curl_close($ch);
	}
	$UserAuth = json_decode($JsonResponse);
  }
  else if (ini_get('allow_url_fopen') == 1) {
	$JsonResponse = file_get_contents($ValidateUrl);
	$UserAuth = json_decode($JsonResponse);
  }
  else {
	echo "Please check php.ini settings<br><b>cURL support = enabled <br>or<br>allow_url_fopen = On</b>";
  }
  if (isset( $UserAuth->IsValid)){
	$this->IsAuth = true;
	return $UserAuth;
  }
}
 }
}
?>

 

/catalogue/includes/languages/english.php code add to the bottom of the file:

define('MODULE_BOXES_LOGINRADIUS_TITLE', 'Social Login');
$title_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_BOXES_LOGINRADIUS_TITLE'");
$title_array = tep_db_fetch_array($title_query);
$title = $title_array['configuration_value'];
 define('MODULE_BOXES_LOGINRADIUS_TITLE', $title);
 define('MODULE_BOXES_LOGINRADIUS_DESCRIPTION', 'Login with Existing Account');
 define('MODULE_BOXES_LOGINRADIUS_BOX_TITLE', $title);

 

I am interesting to find the help with known issues, see above.

Share this post


Link to post
Share on other sites

The error message is telling you that something was output to the browser on line 56 of /catalogue/index.php. You'll have to look in the browser "Page source" to see what the nature of this output is -- part of the expected output, or an error message? What is index.php doing at that point? Is it code added by LoginRadius? Possibly that's too early to have sent HTML to the browser, which prevents any further header updates. Alternately, new code is outputting header updates after the rest of osC has already started outputting HTML to the browser.

Share this post


Link to post
Share on other sites
The error message is telling you that something was output to the browser on line 56 of /catalogue/index.php

only the following line:

<html <?php echo HTML_PARAMS; ?>>

 

part of the expected output, or an error message?

supposed to redirect to create_account_success.php file, instead it's opening the account after a click (as it should be) and refresh the index.php page.

 

Is it code added by LoginRadius?

No.

Share this post


Link to post
Share on other sites

OK, it started outputting the <html> tag, which is normal. Therefore I would suspect it's an architectural difference between 2.2 and 2.3, where 2.3 has consolidated much of the page top boilerplate into a template. In 2.3, there is no direct <html> output -- did you copy massive blocks of code from a 2.2 installation? You are probaly going to have to do a fair amount of modification to the LoginRadius code to make it play nice with osC 2.3.1. Not being familiar with it, unfortunately that's all I can say about it. Also, don't copy blocks of code out of 2.2 into 2.3 until you understand exactly what they're doing and how they interact with the new architecture.

Share this post


Link to post
Share on other sites

Just to revisit this, I dropped in your files and it worked great with only one problem - the infobox was throwing a re-declared class error after logging in with one of the services or going to the cart, so I wrapped the include in a conditional that checked if the class was already declared. In the bm_loginradius.php infobox, just wrap the include like this:

 

if(class_exists('LoginRadius') != true)
{
require(DIR_WS_CLASSES . 'bm_loginradius.php');
}

Share this post


Link to post
Share on other sites

Hello!

Running 2.2

 

I have previously modified login.php & create_account.php files... even when I replace those files with the files included in the package the pages don't load as they should.

 

Any pointers would be appreciated.

Thanks!

-Alex

Share this post


Link to post
Share on other sites

@@negativeexistence

 

If your original files where modified, I suggest using Winmerge or another comparison program to integrate the changes into your original files. Dropping the files on top of your modified files was sure to receive negative results.

 

 

 

Chris

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0