feat(deployed): add Social Login and Social Share 4.0 (no-source, vetted live)

Social Login and Social Share (LoginRadius); repo deleted after CIAM pivot -> deployed files.

Signed-off-by: LÁZÁR Imre <imre@illusion.hu>
Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
LÁZÁR Imre AI Agent 2026-07-16 11:24:47 +02:00
parent 34277a583f
commit 5b6e06e72d
40 changed files with 2329 additions and 0 deletions

View File

@ -0,0 +1,4 @@
<html>
<body bgcolor="#FFFFFF">
</body>
</html>

View File

@ -0,0 +1,203 @@
.loginRadiusProviders input{
margin:0
}
.loginRadiusProviders{
width: 325px;
float: left;
margin-top:6px;
}
.socialTitle{
width: 225px !important;
clear: none !important;
margin: 5px !important;
display:inline !important;
}
div.current input, div.current textarea, div.current select {
float: none !important;
}
dt.open h3 {
background:#ddd !important;
}
dd {
margin-left: 0px !important;
}
dt.tabs h3 {
float: left;
margin-right: 11px;
border: #CCC 1px solid;
padding: 9px;
margin-bottom: 0px;
margin-left: 2px;
border-bottom: 0px;
background: #fff;
}
div.current {
clear: both;
}
.help_ul {
margin:0 0 15px 25px;
padding:0px;
float:left;
list-style:circle;
}
.help_ul li a {
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#000000;
line-height:160%;
}
.stay_ul {
margin:0 0 15px 10px;
padding:0px;
float:left;
list-style:none;
}
.stay_ul li {
line-height:160%;
float:left;
margin:0 10px 0 0;
}
.sociallogin_table .lrsubhead {
font-weight: bold ;
font-size: 13px ;
font-weight: bold ;
}
.sociallogin_form {
padding: 0;
background-color: #fff;
}
.sociallogin_form a {
text-decoration: none !important;
}
.sociallogin_form .blank a {
text-decoration: none !important;
padding: 0 15px !important;
font-weight: bold;
}
.sociallogin_form a:hover {
text-decoration: none !important;;
}
.sociallogin_form legend {
margin-left: 10px;
line-height: 30px;
}
.sociallogin_form .lrrow {
padding: 5px 10px;
font-size: 12px;
clear: both;
overflow: hidden;
}
.sociallogin_form .lrrow_title {
font-size: 14px;
font-weight: bold;
margin-top: 15px;
color:#00ccff;
}
.sociallogin_form .lrrow_button {
background-color: #F6F6F6;
border-top: 1px dotted #ddd;
margin-top: 14px;
padding: 5px 10px;
}
.sociallogin_form .lrrow_description {
padding: 5px 0 10px 10px;
font-weight: bold;
color:#00ccff;
}
.sociallogin_form_main {
background-color: #EAF7FF;
}
.sociallogin_form_main .lrrow {
margin-bottom: 7px;
}
.sociallogin_form_main .lrrow_button {
background-color: #EAF7FF;
}
.icon-48-configuration {
background-image: url("../img/configuration.gif");
}
.sociallogin_table {
background-color: #efefef ;
border: 1px solid #ccc ;
margin-bottom: 10px ;
border-collapse: collapse;
font-family: sans-serif;
font-size: 12px;
line-height: 1.4em;
margin-left: 2px;
width: 100%;
}
.sociallogin_table input {
border-color: #aaa ;
}
.sociallogin_table .head {
font-weight: bold ;
font-size: 13px ;
font-weight: bold ;
background-color: #ddd ;
}
.sociallogin_table th, .sociallogin_table label {
color: #222222;
text-shadow: 0 1px 0 #FFFFFF;
}
.sociallogin_table th {
padding: 10px;
text-align: left;
vertical-align: top;
width: 200px;
}
.sociallogin_table th, .sociallogin_table label {
font-weight: normal;
text-shadow: 0 1px 0 #FFFFFF;
}
.sociallogin_table td {
font-size: 12px;
line-height: 20px;
margin-bottom: 9px;
padding: 8px 10px;
}
.sociallogin_table td, textarea {
line-height: inherit;
}
.sociallogin_table td, textarea, input, select {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
}
.sociallogin_table tr td.sociallogin_row {
line-height: 36px ;
}
.sociallogin_table tr.description td {
color: #0D5995 ;
}
.sociallogin_table .lrrow_white {
background-color: #fff ;
}
.sociallogin_table th, .sociallogin_table label {
color: #222222;
text-shadow: 0 1px 0 #FFFFFF;
}
.sociallogin_table th {
padding: 10px;
text-align: left;
vertical-align: top;
width: 200px;
}
.sociallogin_table th, .sociallogin_table label {
font-weight: normal;
text-shadow: 0 1px 0 #FFFFFF;
}
.lrgreenbutton{
background: #5BB75B;
border-radius: 5px;
text-align: center;
margin: 15px;
padding: 10px 50px;
font-size: 15px;
color:#fff;
text-decoration:none;
font-weight:bold;
}
.lrgreenbutton:hover{
background: #51A351;
}

View File

@ -0,0 +1,4 @@
<html>
<body bgcolor="#FFFFFF">
</body>
</html>

View File

@ -0,0 +1,74 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
jimport ('joomla.application.component.controller');
if(!class_exists('SLASSController')){
if(class_exists('JControllerLegacy')){
class SLASSController extends JControllerLegacy{}
}
else{
class SLASSController extends JController{}
}
}
/**
* Controller of SocialLogin component.
*/
class SocialLoginAndSocialShareController extends SLASSController
{
protected static $actions;
public function display ($cachable = false, $urlparams = false)
{
JRequest::setVar ('view', JRequest::getCmd('view', 'SocialLoginAndSocialShare'));
parent::display ($cachable);
}
/**
* Save settings
*/
public function apply ()
{
$mainframe = JFactory::getApplication();
$model = $this->getModel ();
$input = JFactory::getApplication()->input;
$view = $input->get('view', 'socialloginandsocialshare');
$option = $input->get('option', 'socialloginandsocialshare');
$model->saveSettings($view);
$mainframe->enqueueMessage (JText::_ ('COM_SOCIALLOGIN_SETTING_SAVED'));
$this->setRedirect (JRoute::_ ('index.php?option='.$option.'&view='.$view.'&layout=default', false));
}
/**
* Save and close settings
*/
public function save()
{
$mainframe = JFactory::getApplication();
$model = &$this->getModel();
$input = JFactory::getApplication()->input;
$view = $input->get('view', 'socialloginandsocialshare');
$model->saveSettings ($view);
$mainframe->enqueueMessage (JText::_ ('COM_SOCIALLOGIN_SETTING_SAVED'));
$this->setRedirect (JRoute::_ ('index.php', false));
}
/**
* cancel settings
*/
public function cancel ()
{
$this->setRedirect (JRoute::_ ('index.php', false));
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,4 @@
<html>
<body bgcolor="#FFFFFF">
</body>
</html>

View File

@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS `#__loginradius_settings` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`setting` varchar(255) NOT NULL,
`value` varchar(1000) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `setting` (`setting`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `#__loginradius_users` (
`id` int(11),
`loginradius_id` varchar(255) NULL,
`provider` varchar(255) NULL,
`lr_picture` varchar(255) NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -0,0 +1,299 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.filesystem.folder');
jimport('joomla.installer.installer');
/**
* Script file of socialloginandsocialshare component
*/
class Com_SocialLoginAndSocialShareInstallerScript {
public function postflight($type, $parent) {
if (!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
}
function install($parent){
if (!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
$status = new stdClass;
$status->modules = array();
$status->plugins = array();
$db = JFactory::getDBO ();
$src = $parent->getParent()->getPath('source');
$manifest = $parent->getParent()->manifest;
$isUpdate = JFile::exists(JPATH_SITE.DS.'modules'.DS.'mod_socialloginandsocialshare'.DS.'mod_socialloginandsocialshare.php');
// create a folder inside your images folder
JFolder::create(JPATH_ROOT.DS.'images'.DS.'sociallogin');
// Load sociallogin language file
$lang = JFactory::getLanguage();
$lang->load('com_socialloginandsocialshare', JPATH_SITE);
// Installing modules.
$modules = $manifest->xpath('modules/module');
foreach ($modules AS $module) {
$mod_data = array ();
foreach ($module->attributes () as $key => $value) {
$mod_data [$key] = strval ($value);
}
$mod_data ['client'] = JApplicationHelper::getClientInfo ($mod_data ['client'], true);
if (is_null($mod_data ['client']->name)) $client = 'site';
$path = $src.DS.$mod_data ['module'];
$installer = new JInstaller;
$result = $installer->install($path);
if ($result) {
$status->modules[] = array('name'=>$mod_data ['module'],'client'=>$mod_data ['client']->name, 'result'=>$result);
}
}
if (!$isUpdate) {
$query = "UPDATE #__modules SET title = '".$mod_data ['title']."', position='".$mod_data ['position']."', ordering='".$mod_data ['order']."', published = 1, access=1 WHERE module='".$mod_data ['module']."'";
$db->setQuery($query);
$db->execute();
}
$query = 'SELECT `id` FROM `#__modules` WHERE module = ' . $db->Quote ($mod_data ['module']);
$db->setQuery ($query);
if (!$db->execute()) {
$parent->getParent()->abort (JText::_ ('Module') . ' ' . JText::_ ('Install') . ': ' . $db->stderr (true));
return false;
}
$mod_id = $db->loadResult ();
if ((int) $mod_data ['client']->id == 0) {
$query = 'REPLACE INTO `#__modules_menu` (moduleid,menuid) values (' . $db->Quote ($mod_id) . ',0)';
$db->setQuery ($query);
if (!$db->execute()) {
// Install failed, roll back changes
$parent->getParent()->abort (JText::_ ('Module') . ' ' . JText::_ ('Install') . ': ' . $db->stderr (true));
return false;
}
}
// Installing plugins.
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins AS $plugin) {
$plg_data = array ();
foreach ($plugin->attributes() as $key => $value) {
$plg_data [$key] = strval ($value);
}
$path = $src . DS . 'plg_'.$plg_data['plugin'];
$installer = new JInstaller;
$result = $installer->install($path);
if ($result) {
$query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=".$db->Quote($plg_data ['plugin'])." AND folder=".$db->Quote($plg_data ['group']);
$db->setQuery($query);
$db->execute();
}
// Plugin Installed
$status->plugins[] = array('name'=>$plg_data ['plugin'], 'group'=>$plg_data ['group']);
}
$this->installationResults($status);
}
public function uninstall($parent)
{$db = JFactory::getDBO();
$status = new stdClass;
$status->modules = array();
$status->plugins = array();
$manifest = $parent->getParent()->manifest;
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins as $plugin)
{
$name = (string)$plugin->attributes()->plugin;
$group = (string)$plugin->attributes()->group;
$query = "SELECT `extension_id` FROM #__extensions WHERE `type`='plugin' AND element = ".$db->Quote($name)." AND folder = ".$db->Quote($group);
$db->setQuery($query);
$extensions = $db->loadColumn();
if (count($extensions))
{
foreach ($extensions as $id)
{
$installer = new JInstaller;
$result = $installer->uninstall('plugin', $id);
}
$status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result);
}
}
$modules = $manifest->xpath('modules/module');
foreach ($modules as $module)
{
$name = (string)$module->attributes()->module;
$client = (string)$module->attributes()->client;
$db = JFactory::getDBO();
$query = "SELECT `extension_id` FROM `#__extensions` WHERE `type`='module' AND element = ".$db->Quote($name)."";
$db->setQuery($query);
$extensions = $db->loadColumn();
if (count($extensions))
{
foreach ($extensions as $id)
{
$installer = new JInstaller;
$result = $installer->uninstall('module', $id);
}
$status->modules[] = array('name' => $name, 'client' => $client, 'result' => $result);
}
}
//$this->uninstallationResults($status);
}
public function update($parent)
{
if (!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
$status = new stdClass;
$status->modules = array();
$status->plugins = array();
$db = JFactory::getDBO ();
$src = $parent->getParent()->getPath('source');
$manifest = $parent->getParent()->manifest;
$isUpdate = JFile::exists(JPATH_SITE.DS.'modules'.DS.'mod_socialloginandsocialshare'.DS.'mod_socialloginandsocialshare.php');
// create a folder inside your images folder
JFolder::create(JPATH_ROOT.DS.'images'.DS.'sociallogin');
// Load sociallogin language file
$lang = JFactory::getLanguage();
$lang->load('com_socialloginandsocialshare', JPATH_SITE);
// Installing modules.
$modules = $manifest->xpath('modules/module');
foreach ($modules AS $module) {
$mod_data = array ();
foreach ($module->attributes () as $key => $value) {
$mod_data [$key] = strval ($value);
}
$mod_data ['client'] = JApplicationHelper::getClientInfo ($mod_data ['client'], true);
if (is_null($mod_data ['client']->name)) $client = 'site';
$path = $src.DS.$mod_data ['module'];
$installer = new JInstaller;
$result = $installer->update($path);
if ($result) {
$status->modules[] = array('name'=>$mod_data ['module'],'client'=>$mod_data ['client']->name, 'result'=>$result);
}
}
if (!$isUpdate) {
$query = "UPDATE #__modules SET title = '".$mod_data ['title']."', position='".$mod_data ['position']."', ordering='".$mod_data ['order']."', published = 1, access=1 WHERE module='".$mod_data ['module']."'";
$db->setQuery($query);
$db->execute();
}
$query = 'SELECT `id` FROM `#__modules` WHERE module = ' . $db->Quote ($mod_data ['module']);
$db->setQuery ($query);
if (!$db->execute()) {
$parent->getParent()->abort (JText::_ ('Module') . ' ' . JText::_ ('Install') . ': ' . $db->stderr (true));
return false;
}
$mod_id = $db->loadResult ();
if ((int) $mod_data ['client']->id == 0) {
$query = 'REPLACE INTO `#__modules_menu` (moduleid,menuid) values (' . $db->Quote ($mod_id) . ',0)';
$db->setQuery ($query);
if (!$db->execute()) {
// Install failed, roll back changes
$parent->getParent()->abort (JText::_ ('Module') . ' ' . JText::_ ('Install') . ': ' . $db->stderr (true));
return false;
}
}
// Installing plugins.
$plugins = $manifest->xpath('plugins/plugin');
foreach ($plugins AS $plugin) {
$plg_data = array ();
foreach ($plugin->attributes() as $key => $value) {
$plg_data [$key] = strval ($value);
}
$path = $src . DS . 'plg_'.$plg_data['plugin'];
$installer = new JInstaller;
$result = $installer->update($path);
if ($result) {
$query = "UPDATE #__extensions SET enabled=1 WHERE type='plugin' AND element=".$db->Quote($plg_data ['plugin'])." AND folder=".$db->Quote($plg_data ['group']);
$db->setQuery($query);
$db->execute();
}
// Plugin Installed
$status->plugins[] = array('name'=>$plg_data ['plugin'], 'group'=>$plg_data ['group']);
$query = "SELECT `extension_id` FROM `#__extensions` WHERE type='plugin' AND element=".$db->Quote($plg_data ['plugin'])." AND folder=".$db->Quote($plg_data ['group']);
$db->setQuery ($query);
if (!$db->execute()) {
$parent->getParent()->abort (JText::_ ('Plugin') . ' ' . JText::_ ('Update') . ': ' . $db->stderr (true));
return false;
}
}
$this->installationResults($status);
}
private function installationResults($status)
{
$rows = 0;
if (count($status->modules) AND count($status->plugins)) {?>
<h2>Social Login And Social Share Installation</h2>
<table class="adminlist table table-striped">
<thead>
<tr>
<th class="title" colspan="2"><?php echo JText::_('Extension'); ?></th>
<th><?php echo JText::_('Status'); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3"></td>
</tr>
</tfoot>
<tbody>
<tr>
<th><?php echo JText::_('Component'); ?></th>
<th></th>
<th></th>
</tr>
<tr class="row0">
<td class="key" colspan="2"><?php echo 'Social Login And Social Share '.JText::_('Component'); ?></td>
<td style="color:#6c9c31;"><strong><?php echo JText::_('Installed'); ?></strong></td>
</tr>
<?php if (count($status->modules)) : ?>
<tr>
<th><?php echo JText::_('Module'); ?></th>
<th><?php echo JText::_('Client'); ?></th>
<th></th>
</tr>
<?php foreach ($status->modules as $module) : ?>
<tr class="row<?php echo (++ $rows % 2); ?>">
<td class="key"><?php echo $module['name']; ?></td>
<td class="key"><?php echo ucfirst($module['client']); ?></td>
<td style="color:#6c9c31;"><strong><?php echo JText::_('Installed'); ?></strong></td>
</tr>
<?php endforeach;
endif;
if (count($status->plugins)) : ?>
<tr>
<th><?php echo JText::_('Plugin'); ?></th>
<th><?php echo JText::_('Group'); ?></th>
<th></th>
</tr>
<?php foreach ($status->plugins as $plugin) : ?>
<tr class="row<?php echo (++ $rows % 2); ?>">
<td class="key"><?php echo ucfirst($plugin['name']); ?></td>
<td class="key"><?php echo ucfirst($plugin['group']); ?></td>
<td style="color:#6c9c31;"><strong><?php echo JText::_('Installed'); ?></strong></td>
</tr>
<?php endforeach;
endif; ?>
</tbody>
</table>
<h2><?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_STATUS'); ?></h2>
<p class="nowarning">
<?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_THANK'); ?> <strong>Social Login and Social Share</strong>!
<?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_CONFIG'); ?> <a href="index.php?option=com_socialloginandsocialshare">Social Login <?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_COM'); ?></a>
<?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_FREE'); ?> <a href=" http://community.loginradius.com" target="_blank"><?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_CONTACT'); ?></a> <?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_ASSIST'); ?>
<strong><?php echo JText::_ ('COM_SOCIALLOGIN_INSTALLATION_THANKYOU'); ?></strong>
</p>
<?php }
}
}

View File

@ -0,0 +1 @@
DROP TABLE IF EXISTS `#__loginradius_settings`;

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5" method="upgrade">
<name>Social Login And Social Share</name>
<license>Open Source License, GPL v2 based</license>
<author>LoginRadius</author>
<authorEmail>developers@loginradius.com</authorEmail>
<authorUrl>http://www.loginradius.com</authorUrl>
<creationDate>2012-01-01</creationDate>
<copyright>2013, LoginRadius</copyright>
<version>4.0</version>
<description></description>
<scriptfile>install/script_socialloginandsocialshare.php</scriptfile>
<!-- Installation -->
<install>
<sql>
<file driver="mysql" charset="utf8">install/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">install/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<!-- Component -->
<media destination="com_socialloginandsocialshare" folder="media">
<filename>index.html</filename>
<folder>images</folder>
</media>
<!-- Administration -->
<administration>
<menu img="../media/com_socialloginandsocialshare/images/favicon.png">COM_SOCIALLOGINANDSOCIALSHARE</menu>
<files folder="admin">
<folder>assets</folder>
<folder>install</folder>
<folder>models</folder>
<folder>views</folder>
<file>index.html</file>
<file>controller.php</file>
<file>socialloginandsocialshare.php</file>
</files>
<languages folder="admin/language">
<language tag="en-GB">en-GB/en-GB.com_socialloginandsocialshare.ini</language>
<language tag="en-GB">en-GB/en-GB.com_socialloginandsocialshare.sys.ini</language>
</languages>
</administration>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.com_socialloginandsocialshare.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_socialloginandsocialshare.ini</language>
<language tag="en-GB">en-GB/en-GB.mod_socialloginandsocialshare.sys.ini</language>
</languages>
<!-- Modules -->
<modules>
<module module="mod_socialloginandsocialshare" title="Social Login" position="position-7" order="8" client="site" language="*" showtitle="0">
<files folder="mod_socialloginandsocialshare">
<filename module="mod_socialloginandsocialshare">mod_socialloginandsocialshare.php</filename>
<filename module="mod_socialloginandsocialshare">mod_socialloginandsocialshare.xml</filename>
<filename module="mod_socialloginandsocialshare">helper.php</filename>
<filename module="mod_socialloginandsocialshare">index.html</filename>
<filename module="mod_socialloginandsocialshare">tmpl/default.php</filename>
<filename module="mod_socialloginandsocialshare">images/lr_provider_sprite.png</filename>
<filename module="mod_socialloginandsocialshare">tmpl/index.html</filename>
</files>
</module>
</modules>
<!-- Plugins -->
<plugins>
<plugin plugin="socialloginandsocialshare" title="System - Social Login" order="-100" group="system">
<files folder="plg_socialloginandsocialshare">
<file plugin="socialloginandsocialshare">socialloginandsocialshare.php</file>
<file>facebooklogin.php</file>
<file>googlelogin.php</file>
<file>socialloginandsocialshare_helper.php</file>
<file>socialloginandsocialshare.xml</file>
</files>
</plugin>
<plugin plugin="socialshare" title="Content - Social Share" order="-100" group="content">
<files folder="plg_socialshare">
<file plugin="socialshare">socialshare.php</file>
<file>socialshare.xml</file>
</files>
</plugin>
</plugins>
</extension>

View File

@ -0,0 +1,4 @@
<html>
<body bgcolor="#FFFFFF">
</body>
</html>

View File

@ -0,0 +1,81 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
jimport ('joomla.application.component.modellist');
/**
* SocialLoginAndSocialShare Model.
*/
class SocialLoginAndSocialShareModelSocialLoginAndSocialShare extends JModelList
{
/**
* Save Settings.
*/
public function saveSettings ()
{
$db = $this->getDbo ();
$mainframe = JFactory::getApplication();
//Get database handle
//Read Settings
$settings = JRequest::getVar ('settings');
$articles = JRequest::getVar ('articles');
$settings['articles'] = (sizeof($articles) > 0 ? serialize($articles) : "");
$sql = "DELETE FROM #__loginradius_settings";
$db->setQuery ($sql);
$db->query ();
//Insert new settings
foreach ($settings as $k => $v){
$sql = "INSERT INTO #__loginradius_settings ( setting, value )" . " VALUES ( " . $db->Quote ($k) . ", " . $db->Quote ($v) . " )";
$db->setQuery ($sql);
$db->query ();
}
}
/**
* Read Settings
*/
public function getSettings()
{
$settings = array ();
$db = $this->getDbo();
$sql = "CREATE TABLE IF NOT EXISTS `#__loginradius_settings` (
`id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`setting` VARCHAR( 255 ) NOT NULL ,
`value` VARCHAR( 1000 ) NOT NULL ,
PRIMARY KEY ( `id` ) ,
UNIQUE KEY `setting` ( `setting` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8";
$db->setQuery ($sql);
$db->query ();
$sql = "CREATE TABLE IF NOT EXISTS `#__loginradius_users` (
`id` int(11),
`loginradius_id` varchar(255) NULL,
`provider` varchar(255) NULL,
`lr_picture` varchar(255) NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8";
$db->setQuery ($sql);
$db->query ();
$sql = "SELECT * FROM #__loginradius_settings";
$db->setQuery ($sql);
$rows = $db->LoadAssocList();
if (is_array ($rows))
{
foreach ($rows AS $key => $data)
{
$settings [$data['setting']] = $data ['value'];
}
}
return $settings;
}
}

View File

@ -0,0 +1,30 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
jimport ('joomla.application.component.controller');
if(!class_exists('SLASSController')){
if(class_exists('JControllerLegacy')){
class SLASSController extends JControllerLegacy{}
}
else{
class SLASSController extends JController{}
}
}
// Get an instance of the controller
$controller = SLASSController::getInstance ('SocialLoginAndSocialShare');
// Perform the requested task
$controller->execute (JRequest::getCmd ('task', 'display'));
// Redirect if set by the controller
$controller->redirect ();

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,4 @@
<html>
<body bgcolor="#FFFFFF">
</body>
</html>

View File

@ -0,0 +1,108 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
JHtml::_('behavior.tooltip');
jimport ('joomla.plugin.helper');
jimport('joomla.html.pane');
?>
<form action="<?php echo JRoute::_('index.php?option=com_socialloginandsocialshare&view=socialloginandsocialshare&layout=default'); ?>" method="post" name="adminForm" id="adminForm">
<div>
<div style="float:left; width:70%;">
<div>
<fieldset class="sociallogin_form sociallogin_form_main" style="background:#EAF7FF; border: 1px solid #B3E2FF;">
<div class="lrrow lrrow_title" style="color: #000000; font-weight:normal;">
<?php echo JText::_('COM_SOCIALLOGIN_THANK'); ?>
</div>
<div class="lrrow" style="line-height:160%;">
<?php echo JText::_('COM_SOCIALLOGIN_THANK_BLOCK'); ?>
</div>
<div class="lrrow" style="line-height:160%;">
<?php echo JText::_('COM_SOCIALLOGIN_THANK_BLOCK_TWO'); ?>
</div>
</fieldset>
</div>
<?php
if(class_exists('JPane')){
$pane = JPane::getInstance('tabs', array('startOffset'=>2, 'allowAllClose'=>true, 'opacityTransition'=>true, 'duration'=>600));
echo $pane->startPane( 'pane' );
echo $pane->startPanel( JText::_('COM_SOCIALLOGIN_PANEL_LOGIN'), 'panel1' );
}
else{
$options = array(
'onActive' => 'function(title, description){
description.setStyle("display", "block");
title.addClass("open").removeClass("closed");
}',
'onBackground' => 'function(title, description){
description.setStyle("display", "none");
title.addClass("closed").removeClass("open");
}',
'startOffset' => 0, // 0 starts on the first tab, 1 starts the second, etc...
'useCookie' => true, // this must not be a string. Don't use quotes.
);
echo JHtml::_('tabs.start', 'pane', $options);
echo JHtml::_('tabs.panel', JText::_('COM_SOCIALLOGIN_PANEL_LOGIN'), 'panel1');
}
?>
<!-- social login -->
<div>
<?php echo $this->loadTemplate('facebook');?>
<?php echo $this->loadTemplate('google');?>
</div>
<?php if(class_exists('JPane')){echo $pane->endPanel();}?>
<!-- End social login -->
<!-- social share -->
<?php if(class_exists('JPane')){echo $pane->startPanel( JText::_('COM_SOCIALLOGIN_PANEL_SHARE'), 'panel2' );}
else{echo JHtml::_('tabs.panel', JText::_('COM_SOCIALLOGIN_PANEL_SHARE'), 'panel2');}?>
<div>
<?php echo $this->loadTemplate('share');?>
</div>
<?php if(class_exists('JPane')){echo $pane->endPanel();}?>
<!-- End social share -->
</div>
<div style="float:right; width:29%;">
<div style="background:#EAF7FF; border: 1px solid #B3E2FF; overflow:auto; margin:0 0 10px 0;">
<h3 style="border-bottom:#000000 1px solid; margin:0px; padding:0 0 6px 0; border-bottom: 1px solid #B3E2FF; color: #000000; margin:10px;"><?php echo JText::_('COM_SOCIALLOGIN_EXTENSION_HELP'); ?></h3>
<ul class="help_ul">
<li><a href="http://support.loginradius.com/customer/portal/articles/1299418-joomla-social-login-and-social-share-installation-and-configuration" target="_blank"><?php echo JText::_('COM_SOCIALLOGIN_EXTENSION_HELP_LINK_ONE'); ?></a></li>
<li><a href="http://community.loginradius.com/" target="_blank"><?php echo JText::_('COM_SOCIALLOGIN_EXTENSION_HELP_LINK_FOUR'); ?></a></li>
<li><a href="https://www.loginradius.com/loginradius/Team" target="_blank"><?php echo JText::_('COM_SOCIALLOGIN_EXTENSION_HELP_LINK_FIVE'); ?></a></li>
<li><a href="https://www.loginradius.com/loginradius/product-overview" target="_blank"><?php echo JText::_('COM_SOCIALLOGIN_EXTENSION_HELP_LINK_SIX'); ?></a></li>
</ul>
</div>
<div style="clear:both;"></div>
<div style="background:#EAF7FF; border: 1px solid #B3E2FF; margin:0 0 10px 0; overflow:auto;">
<h3 style="border-bottom:#000000 1px solid; margin:0px; padding:0 0 6px 0; border-bottom: 1px solid #B3E2FF; color: #000000; margin:10px;"><?php echo JText::_('COM_SOCIALLOGIN_STAY_UPDATE'); ?></h3>
<p align="justify" style="line-height: 19px;font-size:12px !important;margin:10px;">
<?php echo JText::_('COM_SOCIALLOGIN_EXTENSION_TECH_SUPPORT_TEXT_ONE'); ?> </p>
<ul class="stay_ul">
<li class="first">
<iframe rel="tooltip" scrolling="no" frameborder="0" allowtransparency="true" style="border: none; overflow: hidden; width: 46px; height: 70px;" src="//www.facebook.com/plugins/like.php?app_id=194112853990900&amp;href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FLoginRadius%2F119745918110130&amp;send=false&amp;layout=box_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=90" data-original-title="Like us on Facebook"></iframe>
</li>
</ul>
<div>
</div>
</div>
</div>
</div>
<input type="hidden" name="task" value="" />
</form>

View File

@ -0,0 +1,50 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
?>
<table class="form-table sociallogin_table">
<tr>
<th class="head" colspan="2"><?php echo JText::_('COM_SOCIALLOGIN_APP_HEAD_SETTING'); ?></small></th>
</tr>
<tr >
<td colspan="2" ><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALLOGIN_FACEBOOK_SUBHEAD'); ?></span>
<br/><br />
<?php
$fbenableLogin = "";
$fbdisableLogin= "";
$fbenable = (isset($this->settings['fbenable']) ? $this->settings['fbenable'] : "");
if ($fbenable == '0') $fbdisableLogin = "checked='checked'";
else if ($fbenable == '1') $fbenableLogin = "checked='checked'";
else $fbenableLogin = "checked='checked'";?>
<input name="settings[fbenable]" type="radio" value="1" <?php echo $fbenableLogin; ?> /> <?php echo JText::_('COM_SOCIALLOGIN_FBYES'); ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="settings[fbenable]" type="radio" value="0" <?php echo $fbdisableLogin; ?> /> <?php echo JText::_('COM_SOCIALLOGIN_FBNO'); ?>
</td>
</tr>
<tr class="lrrow_white"><td><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALLOGIN_TITLE_SUBHEAD'); ?></span><br /><br />
<input size="60" type="text" name="settings[logintitle]" id="logintitle" value="<?php echo (isset ($this->settings ['logintitle']) ? htmlspecialchars ($this->settings ['logintitle']) : ''); ?>" />
</td></tr>
<tr>
<td colspan="2" ><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALLOGIN_FBAPIKEY_SUBHEAD'); ?></span>
<br/><br />
<div class="loginRadiusProviders"><?php echo JText::_('COM_SOCIALLOGIN_FBAPIKEY'); ?></div><input size="60" type="text" name="settings[fbapikey]" id="fbapikey" value="<?php echo (isset ($this->settings ['fbapikey']) ? htmlspecialchars ($this->settings ['fbapikey']) : ''); ?>" />
<br /><br />
<div class="loginRadiusProviders"><?php echo JText::_('COM_SOCIALLOGIN_FBAPISECRET'); ?></div><input size="60" type="text" name="settings[fbapisecret]" id="fbapisecret" value="<?php echo (isset ($this->settings ['fbapisecret']) ? htmlspecialchars ($this->settings ['fbapisecret']) : ''); ?>" />
</td>
</tr>
<tr class="lrrow_white">
<td>
<div class="loginRadiusProviders"><?php echo JText::_('COM_SOCIALLOGIN_FBCALLBACK'); ?></div><span class="lrsubhead"><?php echo JURI::root().'?provider=facebook';?></span>
</td>
</tr>

View File

@ -0,0 +1,43 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
?>
<tr>
<td colspan="2" ><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALLOGIN_GOOGLE_SUBHEAD'); ?></span>
<br/><br />
<?php $enableLogin = "";
$disableLogin= "";
$genable = (isset($this->settings['genable']) ? $this->settings['genable'] : "");
if ($genable == '0') $disableLogin = "checked='checked'";
else if ($genable == '1') $enableLogin = "checked='checked'";
else $enableLogin = "checked='checked'";?>
<input name="settings[genable]" type="radio" value="1" <?php echo $enableLogin; ?> /> <?php echo JText::_('COM_SOCIALLOGIN_GYES'); ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="settings[genable]" type="radio" value="0" <?php echo $disableLogin; ?> /> <?php echo JText::_('COM_SOCIALLOGIN_GNO'); ?>
</td>
</tr>
<tr class="lrrow_white">
<td colspan="2" ><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALLOGIN_GAPIKEY_SUBHEAD'); ?></span>
<br/><br />
<div class="loginRadiusProviders"><?php echo JText::_('COM_SOCIALLOGIN_GAPIKEY'); ?></div>
<input size="60" type="text" name="settings[gapikey]" id="gapikey" value="<?php echo (isset ($this->settings ['gapikey']) ? htmlspecialchars ($this->settings['gapikey']) : ''); ?>" />
<br /><br />
<div class="loginRadiusProviders"><?php echo JText::_('COM_SOCIALLOGIN_GAPISECRET'); ?></div><input size="60" type="text" name="settings[gapisecret]" id="gapisecret" value="<?php echo (isset ($this->settings ['gapisecret']) ? htmlspecialchars ($this->settings ['gapisecret']) : ''); ?>" />
</td>
</tr>
<tr>
<td>
<div class="loginRadiusProviders"><?php echo JText::_('COM_SOCIALLOGIN_GCALLBACK'); ?></div><span class="lrsubhead"><?php echo JURI::root().'?provider=google';?></span>
</td>
</tr>
</table>

View File

@ -0,0 +1,115 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
?>
<table class="form-table sociallogin_table">
<tr>
<th class="head" colspan="2"><?php echo JText::_('COM_SOCIALSHARE_HEAD'); ?></th>
</tr>
<tr>
<td><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALSHARE_SUBHEAD'); ?></span><br /><br />
<?php $enableshare = "";
$disableshare= "";
$share = (isset($this->settings['share']) ? $this->settings['share'] : "");
if ($share == '0') $disableshare = "checked='checked'";
else if ($share == '1') $enableshare = "checked='checked'";
else $enableshare = "checked='checked'";?>
<input name="settings[share]" type="radio" value="1" <?php echo $enableshare; ?> /> <?php echo JText::_('COM_SOCIALSHARE_SHARE_YES'); ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="settings[share]" type="radio" value="0" <?php echo $disableshare; ?> /> <?php echo JText::_('COM_SOCIALSHARE_SHARE_NO'); ?>
</td>
</tr>
<tr class="lrrow_white"><td><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALSHARE_SHARETITLE_SUBHEAD'); ?></span><br /><br />
<input size="60" type="text" name="settings[sharetitle]" id="sharetitle" value="<?php echo (isset ($this->settings ['sharetitle']) ? htmlspecialchars ($this->settings ['sharetitle']) : ''); ?>" />
</td></tr>
<tr>
<td><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALSHARE_INTERFACE_SUBHEAD'); ?></span><br /><br />
<?php
$fblike = "";
$fbsend= "";
$googleplus= "";
$googleshare= "";
$fblikeenable = (isset($this->settings['fblike']) == 'on' ? 'on' : 'off');
$fbsendenable = (isset($this->settings['fbsend']) == 'on' ? 'on' : 'off');
$googleplusenable = (isset($this->settings['googleplus']) == 'on' ? 'on' : 'off');
$googleshareenable = (isset($this->settings['googleshare']) == 'on' ? 'on' : 'off');
if ($fblikeenable == 'on'){ $fblike = "checked='checked'";}
if ($fbsendenable == 'on'){ $fbsend = "checked='checked'";}
if ($googleplusenable == 'on'){ $googleplus = "checked='checked'";}
if ($googleshareenable == 'on'){ $googleshare = "checked='checked'";}
?>
<div class="loginRadiusProviders">
<input name="settings[fblike]" id="fblike" type="checkbox" <?php echo $fblike;?> value="on" style="float: left !important;margin: 0; padding: 0;"/>
<label class="socialTitle" for="fblike" style=" float: left; line-height: 5px;"> <?php echo JText::_('COM_SOCIALSHARE_FACEBOOK_LIKE'); ?></label>
</div>
<div class="loginRadiusProviders">
<input name="settings[fbsend]" id="fbsend" type="checkbox" <?php echo $fbsend;?> value="on" style="float: left !important;margin: 0; padding: 0;" />
<label class="socialTitle" for="fbsend" style=" float: left; line-height: 5px;"> <?php echo JText::_('COM_SOCIALSHARE_FACEBOOK_SEND'); ?></label>
</div>
<div class="loginRadiusProviders">
<input name="settings[googleplus]" id="googleplus" type="checkbox" <?php echo $googleplus;?> value="on" style="float: left !important;margin: 0; padding: 0;" />
<label class="socialTitle" for="googleplus" style=" float: left; line-height: 5px;"> <?php echo JText::_('COM_SOCIALSHARE_GOOGLE_PLUS'); ?></label>
</div>
<div class="loginRadiusProviders">
<input name="settings[googleshare]" id="googleshare" type="checkbox" <?php echo $googleshare;?> value="on" style="float: left !important;margin: 0; padding: 0;" />
<label class="socialTitle" for="googleshare" style=" float: left; line-height: 5px;"> <?php echo JText::_('COM_SOCIALSHARE_GOOGLE_SHARE'); ?></label>
</div>
</td>
</tr>
<tr class="lrrow_white">
<td><span class="lrsubhead"> <?php echo JText::_('COM_SOCIALSHARE_POSITION_SUBHEAD'); ?></span><br /><br />
<?php
$shareontop = "";
$shareonbottom = "";
$shareontoppos = (isset($this->settings['shareontoppos']) == 'on' ? 'on' : 'off');
if ($shareontoppos == 'on'){ $shareontop = "checked='checked'";}
$shareonbottompos = (isset($this->settings['shareonbottompos']) == 'on' ? 'on' : 'off');
if ($shareonbottompos == 'on'){ $shareonbottom = "checked='checked'";}
?>
<div class="loginRadiusProviders">
<input name="settings[shareontoppos]" type="checkbox" id="shareontoppos" <?php echo $shareontop;?> value="on" style="float: left !important;margin: 0; padding: 0;" />
<label class="socialTitle" for="shareontoppos" style=" float: left; line-height: 5px;"><?php echo JText::_('COM_SOCIALSHARE_POSITION_TOP'); ?></label>
</div>
<div class="loginRadiusProviders">
<input name="settings[shareonbottompos]" id="shareonbottompos" type="checkbox" <?php echo $shareonbottom;?> value="on" style="float: left !important;margin: 0; padding: 0;" />
<label class="socialTitle" for="shareonbottompos" style=" float: left; line-height: 5px;"><?php echo JText::_('COM_SOCIALSHARE_POSITION_BOTTOM'); ?></label>
</div>
</td>
</tr>
<tr>
<td>
<span class="lrsubhead"><?php echo JText::_('COM_SOCIALSHARE_ARTICLES_SUBHEAD'); ?></span><br /><br />
<?php $db = JFactory::getDBO();
$query = "SELECT id, title FROM #__content WHERE state = '1' ORDER BY ordering";
$db->setQuery($query);
$rows = $db->loadObjectList();
?>
<?php $articles = (isset($this->settings['articles']) ? $this->settings['articles'] : "");
$articles = unserialize($articles);?>
<select id="articles[]" name="articles[]" multiple="multiple" style="width:400px;">
<?php foreach ($rows as $row) {?>
<option <?php if (!empty($articles)) {
foreach ($articles as $key=>$value) {
if ($row->id == $value) {
echo " selected=\"selected\"";
}
}
}?>value="<?php echo $row->id;?>" >
<?php echo $row->title;?>
</option>
<?php }?>
</select>
</td>
</tr>
</table>

View File

@ -0,0 +1,56 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Restricted access');
jimport ('joomla.application.component.view');
if(!class_exists('SLASSViewSettings')){
if(class_exists('JViewLegacy')){
class SLASSViewSettings extends JViewLegacy{}
}
else{
class SLASSViewSettings extends JView{}
}
}
/**
* Class generate view.
*/
class SocialLoginAndSocialShareViewSocialLoginAndSocialShare extends SLASSViewSettings
{
public $settings;
/**
* SocialLogin - Display administration area
*/
public function display ($tpl = null)
{
$document = JFactory::getDocument ();
$document->addStyleSheet ('components/com_socialloginandsocialshare/assets/css/socialloginandsocialshare.css');
$model = $this->getModel ();
$this->settings = $model->getSettings ();
$this->form = $this->get ('Form');
$this->addToolbar ();
parent::display ($tpl);
}
/**
* SocialLogin - Add admin option on toolbar
*/
protected function addToolbar ()
{
JRequest::setVar ('hidemainmenu', false);
JToolBarHelper::title (JText::_ ('COM_SOCIALLOGINANDSOCIALSHARE_CONFIGURATION_TITLE'), 'configuration.gif');
JToolBarHelper::apply ('apply');
JToolBarHelper::save($task = 'save', $alt = 'JTOOLBAR_SAVE');
JToolBarHelper::cancel ('cancel');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,141 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
class modSocialLoginAndSocialShareHelper
{
static function getReturnURL($params, $type)
{
$app = JFactory::getApplication();
$router = $app->getRouter();
$url = null;
if ($itemid = $params->get($type))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->nameQuote('link'));
$query->from($db->nameQuote('#__menu'));
$query->where($db->nameQuote('published') . '=1');
$query->where($db->nameQuote('id') . '=' . $db->quote($itemid));
$db->setQuery($query);
if ($link = $db->loadResult()) {
if ($router->getMode() == JROUTER_MODE_SEF) {
$url = 'index.php?Itemid='.$itemid;
}
else {
$url = $link.'&Itemid='.$itemid;
}
}
}
if (!$url)
{
// stay on the same page
$uri = clone JFactory::getURI();
$vars = $router->parse($uri);
unset($vars['lang']);
if ($router->getMode() == JROUTER_MODE_SEF)
{
if (isset($vars['Itemid']))
{
$itemid = $vars['Itemid'];
$menu = $app->getMenu();
$item = $menu->getItem($itemid);
unset($vars['Itemid']);
if (isset($item) && $vars == $item->query) {
$url = 'index.php?Itemid='.$itemid;
}
else {
$url = 'index.php?'.JURI::buildQuery($vars).'&Itemid='.$itemid;
}
}
else
{
$url = 'index.php?'.JURI::buildQuery($vars);
}
}
else
{
$url = 'index.php?'.JURI::buildQuery($vars);
}
}
return base64_encode($url);
}
static function getType()
{
$user = JFactory::getUser();
return (!$user->get('guest')) ? 'logout' : 'login';
}
/*
* Get the databse settings.
*/
static function sociallogin_getsettings () {
$lr_settings = array ();
$db = JFactory::getDBO ();
$sql = "SELECT * FROM #__loginradius_settings";
$db->setQuery ($sql);
$rows = $db->LoadAssocList ();
if (is_array ($rows)) {
foreach ($rows AS $key => $data) {
$lr_settings [$data ['setting']] = $data ['value'];
}
}
return $lr_settings;
}
/*
* Get facebook login settings.
*/
static function social_url ($lr_settings) {
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::root().'modules/mod_socialloginandsocialshare/lrstyle.css');
$redirect = JURI::root();
$sociallogintitle = (!empty($lr_settings['logintitle']) ? $lr_settings['logintitle'] : "");
$sociallink = $sociallogintitle.'<br>';
$sociallink .= '<div class="lr_social_login_basic_150"> <div id="lr_providers"><div class="lr_icons_box">';
if(isset($lr_settings['fbenable']) && $lr_settings['fbenable'] == "1"){
$fbparams = array(
'client_id=' . $lr_settings['fbapikey'],
'redirect_uri=' . ($redirect.'?provider=facebook'),
'display=popup',
'scope=email,user_photos,user_about_me,user_hometown,user_photos'
);
$fbparams = implode('&', $fbparams);
$fburl = 'http://www.facebook.com/dialog/oauth?' . $fbparams;
$sociallink .= '<div><a class="lr_providericons lr_facebook" href="javascript:void(0);" onclick="javascript:window.open(\''.$fburl.'\',\'Facebook\',\'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400px,height=400px\');" rel="nofollow" title="Login with Facebook" alt="Login with Facebook"></a></div>';?>
<?php }
if(isset($lr_settings['genable']) && $lr_settings['genable'] == "1"){
$gscope = urlencode('https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email');
$gparams = array(
'response_type=code',
'redirect_uri=' . ($redirect.'?provider=google'),
'client_id=' . $lr_settings['gapikey'],
'scope=' . $gscope
);
$gparams = implode('&', $gparams);
$gurl = 'https://accounts.google.com/o/oauth2/auth?'.$gparams;
$sociallink .= '<div><a class="lr_providericons lr_google" href="javascript:void(0);" onclick="javascript:window.open(\''.$gurl.'\',\'Google\',\'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400px,height=400px\');" rel="nofollow" title="Login with Google" alt="Login with Google"></a></div>';
}
$sociallink .= '</div></div>';
$sociallink .= '<br /><a href="http://www.loginradius.com" target="_blank" style="text-decoration:none;font-size:10px;color:#21759B;">Powered By LoginRadius</a></div>';
return $sociallink;
}
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,11 @@
.lr_social_login_basic_150{ width:150px;background:transparent;}
.lr_social_login_basic_150 #lr_providers .lr_icons_box{width:128px;float:left;margin:0 0 0px 0;}
.lr_social_login_basic_150 #lr_providers .lr_icons_box div{float:left;margin:0 3px 4px 0;cursor:pointer;}
.lr_social_login_basic_150 #lr_providers .lr_providericons { width: 60px; height: 26px; background-image: url('images/lr_provider_sprite.png'); cursor: pointer;
display: block; margin: 0 auto; position: relative; z-index: 9998; outline: 0;}
/*icons sprite */
.lr_social_login_basic_150 #lr_providers .lr_facebook:hover { width: 60px; height: 26px; background-position: 0px -78px; }
.lr_social_login_basic_150 #lr_providers .lr_facebook { width: 60px; height: 26px; background-position: 0px -52px; }
.lr_social_login_basic_150 #lr_providers .lr_google:hover { width: 60px; height: 26px; background-position: 0px -26px; }
.lr_social_login_basic_150 #lr_providers .lr_google { width: 60px; height: 26px; background-position: 0px 0px; }

View File

@ -0,0 +1,22 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
// Include the syndicate functions only once
require_once dirname(__FILE__).'/helper.php';
$params->def('greeting', 1);
$type = modSocialLoginAndSocialShareHelper::getType();
$lr_settings = modSocialLoginAndSocialShareHelper::sociallogin_getSettings();
$sociallogin = modSocialLoginAndSocialShareHelper::social_url($lr_settings);
$return = modSocialLoginAndSocialShareHelper::getReturnURL($params, $type);
$user = JFactory::getUser();
require JModuleHelper::getLayoutPath('mod_socialloginandsocialshare', $params->get('layout', 'default'));

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="2.5" client="site" method="upgrade">
<name>Social Login</name>
<creationDate>2012-01-01</creationDate>
<author>LoginRadius</author>
<authorEmail>developers@loginradius.com</authorEmail>
<authorUrl>www.LoginRadius.com</authorUrl>
<copyright>Copyright (C) 2012 - till Open Source Matters. All rights reserved.</copyright>
<license>GPL 2.0</license>
<version>4.0</version>
<description>LoginRadius enables social login and social share for your joomla websites.</description>
<files>
<filename module="mod_socialloginandsocialshare">mod_socialloginandsocialshare.php</filename>
<filename module="mod_socialloginandsocialshare">helper.php</filename>
<filename module="mod_socialloginandsocialshare">index.html</filename>
<filename module="mod_socialloginandsocialshare">lrstyle.css</filename>
<filename module="mod_socialloginandsocialshare">tmpl/default.php</filename>
<filename module="mod_socialloginandsocialshare">images/lr_provider_sprite.png</filename>
<filename module="mod_socialloginandsocialshare">tmpl/index.html</filename>
</files>
</extension>

View File

@ -0,0 +1,58 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
//no direct access
defined( '_JEXEC' ) or die('Restricted access');
JHtml::_('behavior.keepalive');?>
<?php
// Check for plugin enabled.
jimport('joomla.plugin.helper');
if(!JPluginHelper::isEnabled('system','socialloginandsocialshare')) :
JError::raiseNotice ('sociallogin_plugin', JText::_ ('MOD_LOGINRADIUS_PLUGIN_ERROR'));
endif; ?>
<?php
if ($type == 'logout') : ?>
<?php $session = JFactory::getSession();?>
<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" method="post" id="login-form">
<div>
<?php $user_picture = $session->get('user_picture');?>
<div style="float:left;">
<img src="<?php if (!empty($user_picture)) { echo $session->get('user_picture');} else {echo JURI::root().'media/com_socialloginandsocialshare/images/noimage.png';}?>" alt="<?php echo $user->get('name');?>" style="width:50px; height:auto;background: none repeat scroll 0 0 #FFFFFF; border: 1px solid #CCCCCC; display: block; margin: 2px 4px 4px 0; padding: 2px;">
</div>
<div>
<div class="login-greeting" >
<div style=" font-weight:bold;">
<?php
$name = $user->get('name');
if(!empty($name)):
echo JText::sprintf('MOD_LOGINRADIUS_HINAME', $name);
else :
echo JText::sprintf('MOD_LOGINRADIUS_HINAME', $user->get('username'));
endif;
?>
</div>
</div>
<div style="clear:both"></div>
<div class="logout-button">
<input type="submit" name="Submit" class="button" value="<?php echo JText::_('JLOGOUT'); ?>" />
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.logout" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo JHtml::_('form.token');?>
</div>
</div>
</div>
</form>
<?php else : ?>
<?php echo $sociallogin;
endif;?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,228 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* plgContentSocialShare
*/
class plgContentSocialShare extends JPlugin {
/**
* Constructor
* Loads the plugin settings and assigns them to class variables
*/
public function __construct(&$subject)
{
parent::__construct($subject);
// Loading plugin parameters
$lr_settings = $this->sociallogin_getsettings();
//Properties holding plugin settings
?>
<style>
.lrcounter-horizontal-vertical table {
background: none repeat scroll 0 0 transparent !important;
border: medium none !important;
color: #000000 !important;
margin: 0 !important;
padding: 0 !important;
text-align: left !important;
}
.lrcounter-horizontal-vertical table tr, .lrcounter-horizontal-vertical table td {
background: none repeat scroll 0 0 transparent !important;
border: medium none !important;
color: #000000 !important;
display: inline-table;
margin-left: 4px !important;
padding: 0 2px !important;
text-align: left !important;
vertical-align: bottom !important;
}
iframe, svg {
max-width: none !important;
}
</style>
<?php
$this->enableshare = (!empty($lr_settings['share']) ? $lr_settings['share'] : "");
$this->fbapikey = (!empty($lr_settings['fbapikey']) ? $lr_settings['fbapikey'] : "");
$this->sharetitle = (!empty($lr_settings['sharetitle']) ? $lr_settings['sharetitle'] : "");
$this->fblike = (!empty($lr_settings['fblike']) ? $lr_settings['fblike'] : "");
$this->fbsend = (!empty($lr_settings['fbsend']) ? $lr_settings['fbsend'] : "");
$this->googleplus = (!empty($lr_settings['googleplus']) ? $lr_settings['googleplus'] : "");
$this->googleshare = (!empty($lr_settings['googleshare']) ? $lr_settings['googleshare'] : "");
$this->shareontoppos = (!empty($lr_settings['shareontoppos']) ? $lr_settings['shareontoppos'] : "");
$this->shareonbottompos = (!empty($lr_settings['shareonbottompos']) ? $lr_settings['shareonbottompos'] : "");
$this->articles = (!empty($lr_settings['articles']) ? unserialize($lr_settings['articles']) : "");
if($this->enableshare == '1'){
$document = JFactory::getDocument();
$document->addScript('https://apis.google.com/js/plusone.js');
}
}
/**
* Before display content method
*/
public function onContentBeforeDisplay($context, &$article, &$params, $limitstart=0) {
$beforediv ='';
if($this->enableshare == '1'){
$beforediv .='<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$this->fbapikey.'";
fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));</script>';
if($this->shareontoppos == 'on'){
$app = JFactory::getApplication();
if (is_array($this->articles)) {
foreach ($this->articles as $key=>$value) {
if ($article->id == $value) {
$sharetitle = '<div style="margin:0;"><b>'.$this->sharetitle.'</b></div>';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='Off' && !empty($_SERVER['HTTPS'])):
$http='https://';
else:
$http='http://';
endif;
if(!isset($article->language) && empty($article->language)):
$article->language = 0;
endif;
if(!isset($article->catid) && empty($article->catid)):
$article->catid = 0;
endif;
$articlelink = $http.$_SERVER['HTTP_HOST'].JRoute::_(ContentHelperRoute::getArticleRoute($article->id, $article->catid, $article->language));
$beforediv .= "<div align='left' style='padding-bottom:10px;padding-top:10px;'>".$sharetitle."</div>";
$beforediv .= '<div class="lrsharecontainer lrcounter-horizontal-vertical">';
$beforediv .= '<table style="border:none !important;background:none !important;">
<tr style="border:none !important;background:none !important;">
<td style="border:none !important;background:none !important;">';
if($this->fblike == 'on'){
$beforediv .= '<div class="fb-like" data-href="'.$articlelink.'" data-layout="box_count"></div>';
}
$beforediv .= '</td>
<td style="border:none !important;background:none !important;">';
if($this->fbsend == 'on'){
$beforediv .= '<div class="fb-send" data-href="'.$articlelink.'"></div>';
}
$beforediv .= '</td>
<td style="border:none !important;background:none !important;">';
if($this->googleplus == 'on'){
$beforediv .= '<g:plus action="share" annotation="vertical-bubble" href="'.$articlelink.'"></g:plus>';
}
$beforediv .= '</td>
<td style="border:none !important;background:none !important;">';
if($this->googleshare == 'on'){
$beforediv .= '<g:plusone action="share" annotation="none" href="'.$articlelink.'"></g:plusone>';
}
$beforediv .= '</td>
</tr>
</table>';
$beforediv .= '</div>';
}
}
}
}
}
return $beforediv;
}
/**
* After display content method
*/
public function onContentAfterDisplay($context, &$article, &$params, $limitstart=0) {
$afterdiv = '';
if($this->enableshare == '1'){
$afterdiv .='<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$this->fbapikey.'";
fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));</script>';
if($this->shareonbottompos == 'on'){
$app = JFactory::getApplication();
if (is_array($this->articles)) {
foreach ($this->articles as $key=>$value) {
if ($article->id == $value) {
$sharetitle = '<div style="margin:0;"><b>'.$this->sharetitle.'</b></div>';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='Off' && !empty($_SERVER['HTTPS'])):
$http='https://';
else:
$http='http://';
endif;
if(!isset($article->language) && empty($article->language)):
$article->language = 0;
endif;
if(!isset($article->catid) && empty($article->catid)):
$article->catid = 0;
endif;
$articlelink = $http.$_SERVER['HTTP_HOST'].JRoute::_(ContentHelperRoute::getArticleRoute($article->id, $article->catid, $article->language));
$afterdiv .= "<div align='left' style='padding-bottom:10px;padding-top:10px;'>".$sharetitle."</div>";
$afterdiv .= '<div class="lrsharecontainer lrcounter-horizontal-vertical">';
$afterdiv .= '<table style="border:none !important;background:none !important;">
<tr style="border:none !important;background:none !important;">
<td style="border:none !important;background:none !important;">';
if($this->fblike == 'on'){
$afterdiv .= '<div class="fb-like" data-href="'.$articlelink.'" data-layout="box_count"></div>';
}
$afterdiv .= '</td>
<td style="border:none !important;background:none !important;">';
if($this->fbsend == 'on'){
$afterdiv .= '<div class="fb-send" data-href="'.$articlelink.'"></div>';
}
$afterdiv .= '</td>
<td style="border:none !important;background:none !important;">';
if($this->googleplus == 'on'){
$afterdiv .= '<g:plus action="share" annotation="vertical-bubble" href="'.$articlelink.'"></g:plus>';
}
$afterdiv .= '</td>
<td style="border:none !important;background:none !important;">';
if($this->googleshare == 'on'){
$afterdiv .= '<g:plusone action="share" annotation="none" href="'.$articlelink.'"></g:plusone>';
}
$afterdiv .= '</td>
</tr>
</table>';
$afterdiv .= '</div>';
}
}
}
}
}
return $afterdiv;
}
/**
* Get the databse settings.
*/
private function sociallogin_getsettings () {
$lr_settings = array ();
$db = JFactory::getDBO ();
$sql = "SELECT * FROM #__loginradius_settings";
$db->setQuery ($sql);
$rows = $db->LoadAssocList ();
if (is_array ($rows)) {
foreach ($rows AS $key => $data) {
$lr_settings [$data ['setting']] = $data ['value'];
}
}
return $lr_settings;
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content">
<name>Content - Social Share</name>
<license>GNU/GPL</license>
<author>LoginRadius</author>
<authorEmail>developers@loginradius.com</authorEmail>
<authorUrl>http://www.loginradius.com</authorUrl>
<creationDate>2012-01-01</creationDate>
<copyright>2012 to till</copyright>
<version>4.0</version>
<description>LoginRadius enables social share for your joomla websites.</description>
<files>
<file plugin="socialshare">socialshare.php</file>
</files>
</extension>

View File

@ -0,0 +1,73 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
/**
* SocialLogin Facebook Login class.
*/
class facebooklogin {
public static function acsses_token($code, $lr_settings){
$redirect = JURI::root().'?provider=facebook';
$params = array(
'client_id=' . $lr_settings['fbapikey'],
'client_secret=' . $lr_settings['fbapisecret'],
'code=' . $code,
'redirect_uri='. $redirect
);
$params = implode('&', $params);
$url = 'https://graph.facebook.com/oauth/access_token?' . $params;
$data = plgSystemSocialLoginTools::open_http($url);
parse_str($data, $data_array);
if(empty($data_array['access_token'])){
echo 'Error - empty access tocken';
exit;
}
$ResponseUrl = 'https://graph.facebook.com/me?access_token='.$data_array['access_token'];
$request = json_decode(plgSystemSocialLoginTools::open_http($ResponseUrl));
if(empty($request)){
echo 'Error - empty user data';
exit;
}
else if(!empty($request->error)){
echo 'Error - '. $request->error;
exit;
}
return $request;
}
/*
* Function getting user data from loginradius.
*/
public static function userprofile_data($userprofile) {
$lrdata['session'] = uniqid('LoginRadius_', true);
$lrdata['id'] = (!empty($userprofile->id) ? $userprofile->id : "");
$lrdata['FullName'] = (!empty($userprofile->name) ? $userprofile->name : "");
$lrdata['ProfileName'] = (!empty( $userprofile->username) ? $userprofile->username : "");
$lrdata['fname'] = (!empty( $userprofile->first_name) ? $userprofile->first_name : "");
$lrdata['lname'] = (!empty($userprofile->last_name) ? $userprofile->last_name : "");
$lrdata['gender'] = (!empty($userprofile->gender) ? $userprofile->gender : '');
$lrdata['Provider'] = 'facebook';
$lrdata['email'] = (!empty($userprofile->email) ? $userprofile->email : "");
$lrdata['thumbnail'] = (!empty ($userprofile->ThumbnailImageUrl) ? trim($userprofile->ThumbnailImageUrl) : "");
$lrdata['ProfileUrl'] = (!empty($userprofile->link) ? $userprofile->link : '');
$lrdata['thumbnail'] = "http://graph.facebook.com/".$lrdata['id']."/picture?type=square";
$lrdata['address1'] = (!empty($userprofile->location->name) ? $userprofile->location->name :"");
$lrdata['address2'] = $lrdata['address1'];
$lrdata['city'] = (!empty($userprofile->hometown) ? $userprofile->hometown : "");
return $lrdata;
}
}
?>

View File

@ -0,0 +1,70 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
/**
* SocialLogin Google Login class.
*/
class googlelogin {
public static function acsses_token($code, $lr_settings){
$redirect = JURI::root();
$scope = urlencode('https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email');
$params = array(
'client_id=' . $lr_settings['gapikey'],
'client_secret=' . $lr_settings['gapisecret'],
'grant_type=authorization_code',
'code=' . $code,
'redirect_uri=' . ($redirect.'?provider=google'),
'scope=' . $scope
);
$params = implode('&', $params);
$url = 'https://accounts.google.com/o/oauth2/token';
$request = json_decode(plgSystemSocialLoginTools::open_http($url, true, $params));
if(empty($request)){
echo 'Error - empty user data';
exit;
}
$url = 'https://www.googleapis.com/oauth2/v1/userinfo?access_token='.$request->access_token;
$request = json_decode(plgSystemSocialLoginTools::open_http($url));
if(empty($request)){
echo 'Error - empty user data';
exit;
}
else if(!empty($request->error)){
echo 'Error - '. $request->error;
exit;
}
return $request;
}
/*
* Function getting user data from loginradius.
*/
public static function userprofile_data($userprofile) {
$lrdata['id'] = (!empty($userprofile->id) ? $userprofile->id : "");
$lrdata['FullName'] = (!empty($userprofile->name) ? $userprofile->name : "");
$lrdata['ProfileName'] = (!empty( $userprofile->name) ? $userprofile->name : "");
$lrdata['fname'] = (!empty( $userprofile->given_name) ? $userprofile->given_name : "");
$lrdata['lname'] = (!empty($userprofile->family_name) ? $userprofile->family_name : "");
$lrdata['gender'] = (!empty($userprofile->gender) ? $userprofile->gender : '');
$lrdata['Provider'] = 'google';
$lrdata['email'] = (!empty($userprofile->email) ? $userprofile->email : "");
$lrdata['ProfileUrl'] = (!empty($userprofile->link) ? $userprofile->link : '');
$lrdata['dob'] = (!empty($userprofile->birthday) ? $userprofile->birthday : '');
$lrdata['thumbnail'] = '';
return $lrdata;
}
}
?>

View File

@ -0,0 +1,356 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Restricted access');
jimport ('joomla.plugin.plugin');
jimport ('joomla.filesystem.file');
jimport ('joomla.user.helper');
jimport ('joomla.mail.helper' );
jimport ('joomla.application.component.helper');
jimport ('joomla.application.component.modelform');
jimport ('joomla.application.component.controller' );
jimport ('joomla.event.dispatcher');
jimport ('joomla.plugin.helper');
jimport ('joomla.utilities.date');
if (!defined('DS')) {
define('DS',DIRECTORY_SEPARATOR);
}
// Includes plugins required files.
require_once(dirname (__FILE__) . DS . 'socialloginandsocialshare_helper.php');
require_once(dirname (__FILE__) . DS . 'googlelogin.php');
require_once(dirname (__FILE__) . DS . 'facebooklogin.php');
/*
* Class that indicates the plugin.
*/
class plgSystemSocialLoginAndSocialShare extends JPlugin {
/*
* Class constructor.
*/
function plgSystemSocialLoginAndSocialShare(&$subject, $config) {
parent::__construct($subject,$config);
}
/*
* Plugin class function that calls on after plugin intialise.
*/
function onAfterInitialise() {
$lrdata = array(); $user_id = ''; $id = ''; $email = ''; $msg = ''; $defaultUserGroups = ''; $lr_settings = array();
$lr_settings = plgSystemSocialLoginTools::sociallogin_getsettings ();
// Get module configration option value
$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$config = JFactory::getConfig();
$language = JFactory::getLanguage();
$session = JFactory::getSession();
$language->load('com_users');
$language->load('com_socialloginandsocialshare', JPATH_ADMINISTRATOR);
$authorize = JFactory::getACL();
$input = JFactory::getApplication()->input;
$code = $input->get('code', null, 'STRING');
$provider = $input->get('provider', null, 'STRING');
// Checking user is logged in.
if (isset($code) && !empty($code)) {
if($provider=='google'){
$userprofile = googlelogin::acsses_token($code, $lr_settings);
$lrdata = googlelogin::userprofile_data($userprofile);
}elseif($provider=='facebook'){
$userprofile = facebooklogin::acsses_token($code, $lr_settings);
$lrdata = facebooklogin::userprofile_data($userprofile);
}
}
// User is not logged in trying to make log in user.
if (isset($lrdata) && !empty($lrdata) && !JFactory::getUser()->id) {
// Remove the session if any.
if ($session->get('tmpuser')) {
$session->clear('tmpuser');
}
//$lrdata = plgSystemSocialLoginTools::facebook_userprofile_data($userprofile);
// Find the not activate user.
$query = "SELECT u.id FROM #__users AS u INNER JOIN #__LoginRadius_users AS lu ON lu.id = u.id WHERE lu.LoginRadius_id = '".$lrdata['id']."' AND u.activation != '' AND u.activation != 0";
$db->setQuery($query);
$block_id = $db->loadResult();
if (!empty($block_id) || $block_id) {
JError::raiseWarning ('', JText::_ ('COM_SOCIALLOGIN_USER_NOTACTIVATE'));
return false;
}
// Find the block user.
$query = "SELECT u.id FROM #__users AS u INNER JOIN #__LoginRadius_users AS lu ON lu.id = u.id WHERE lu.LoginRadius_id = '".$lrdata['id']."' AND u.block = 1";
$db->setQuery($query);
$block_id = $db->loadResult();
if (!empty($block_id) || $block_id) {
JError::raiseWarning ('', JText::_ ('COM_SOCIALLOGIN_USER_BLOCK'));
return false;
}
}
// Checking user click on popup cancel button.
if (isset($lrdata['id']) && !empty($lrdata['id']) && !empty($lrdata['email'])) {
// Filter username form data.
if (!empty($lrdata['fname']) && !empty($lrdata['lname'])) {
$username = $lrdata['fname'].$lrdata['lname'];
$name = $lrdata['fname'];
}
else {
$username = plgSystemSocialLoginTools::get_filter_username($lrdata);
$name = plgSystemSocialLoginTools::get_filter_username($lrdata);
}
$query="SELECT u.id FROM #__users AS u INNER JOIN #__LoginRadius_users AS lu ON lu.id = u.id WHERE lu.LoginRadius_id = '".$lrdata['id']."'";
$db->setQuery($query);
$user_id = $db->loadResult();
// If not then check for email exist.
if (empty($user_id)) {
$query = "SELECT id FROM #__users WHERE email='".$lrdata['email']."'";
$db->setQuery($query);
$user_id = $db->loadResult();
if (!empty($user_id)) {
$query = "SELECT LoginRadius_id from #__LoginRadius_users WHERE LoginRadius_id=".$db->Quote ($lrdata['id'])." AND id = " . $user_id;
$db->setQuery($query);
$check_id = $db->loadResult();
if (empty($check_id)) {
// Add new id to db.
$userImage = $lrdata['thumbnail'];
$sql = "INSERT INTO #__LoginRadius_users SET id = " . $user_id . ", LoginRadius_id = " . $db->Quote ($lrdata['id']).", provider = " . $db->Quote ($lrdata['Provider']) . ", lr_picture = " . $db->Quote ($userImage);
$db->setQuery ($sql);
$db->execute();
}
}
}
$newuser = true;
if (isset($user_id)) {
$user = JFactory::getUser($user_id);
if ($user->id == $user_id) {
$newuser = false;
}
}
if ($newuser == true) {
$user = new JUser;
$need_verification = false;
// If user registration is not allowed, show 403 not authorized.
$usersConfig = JComponentHelper::getParams( 'com_users' );
if ($usersConfig->get('allowUserRegistration') == '0') {
JError::raiseWarning( '', JText::_( 'COM_SOCIALLOGIN_REGISTER_DISABLED'));
return false;
}
// Default to Registered.
$defaultUserGroups = $usersConfig->get('new_usertype', 2);
if (empty($defaultUserGroups)) {
$defaultUserGroups = 'Registered';
}
// if username already exists
$username = plgSystemSocialLoginTools::get_exist_username($username);
// Remove special char if have.
$username = plgSystemSocialLoginTools::remove_unescapedChar($username);
$name = plgSystemSocialLoginTools::remove_unescapedChar($name);
//Insert data
jimport ('joomla.user.helper');
$userdata = array ();
$userdata ['name'] = $db->escape($name);
$userdata ['username'] = $db->escape($username);
$userdata ['email'] = $lrdata['email'];
$userdata ['usertype'] = 'deprecated';
$userdata ['groups'] = array($defaultUserGroups);
$userdata ['registerDate'] = JFactory::getDate ()->toSql ();
$userdata ['password'] = JUserHelper::genRandomPassword ();
$userdata ['password2'] = $userdata ['password'];
$useractivation = $usersConfig->get( 'useractivation' );
if (isset($_POST['sociallogin_emailclick']) AND $useractivation != '2') {
$need_verification = true;
}
if ($useractivation == '2' OR $need_verification == true) {
$userdata ['activation'] = JApplication::getHash(JUserHelper::genRandomPassword());
$userdata ['block'] = 1;
}
else {
$userdata ['activation'] = '';
$userdata ['block'] = 0;
}
if (!$user->bind ($userdata)) {
JError::raiseWarning ('', JText::_ ('COM_USERS_REGISTRATION_BIND_FAILED'));
return false;
}
//Save the user
if (!$user->save()) {
JError::raiseWarning ('', JText::_ ('COM_SOCIALLOGIN_REGISTER_FAILED'));
return false;
}
$user_id = $user->get ('id');
// Saving user extra profile.
//plgSystemSocialLoginTools::save_userprofile_data($user_id, $lrdata);
// Trying to insert image.
$userImage = $lrdata['thumbnail'];
// Remove.
$sql = "DELETE FROM #__LoginRadius_users WHERE LoginRadius_id = " . $db->Quote ($lrdata['id']);
$db->setQuery ($sql);
if ($db->execute()) {
//Add new id to db
$sql = "INSERT INTO #__LoginRadius_users SET id = " . $db->quote ($user_id) . ", LoginRadius_id = " . $db->Quote ($lrdata['id']).", provider = " . $db->Quote ($lrdata['Provider']).", lr_picture = " . $db->Quote ($userImage);
$db->setQuery ($sql);
$db->execute();
}
// Handle account activation/confirmation emails.
if ($useractivation == '2' OR $need_verification == true) {
if ($need_verification == true) {
$usermessgae = 3;
$this->_sendMail($user, $usermessgae);
$mainframe->enqueueMessage(JText::_ ('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
$session->clear('tmpuser');
return false;
}
else {
$usermessgae = 1;
$this->_sendMail($user, $usermessgae);
$mainframe->enqueueMessage(JText::_ ('COM_USERS_REGISTRATION_COMPLETE_VERIFY'));
$session->clear('tmpuser');
return false;
}
}
else {
$usermessgae = 2;
$this->_sendMail($user, $usermessgae);
}
}
}
if ($user_id) {
$user = JUser::getInstance((int)$user_id);
//Register session variables
$session = JFactory::getSession();
$query = "SELECT lr_picture from #__LoginRadius_users WHERE LoginRadius_id=".$db->Quote ($lrdata['id'])." AND id = " . $user->get('id');
$db->setQuery($query);
$check_picture = $db->loadResult();
$session->set('user_picture',$check_picture);
$session->set('user_lrid',$lrdata['id']);
$session->set('user',$user);
// Getting the session object
$table = JTable::getInstance('session');
$table->load( $session->getId());
$table->guest = '0';
$table->username = $user->get('username');
$table->userid = intval($user->get('id'));
$table->usertype = $user->get('usertype');
$table->gid = $user->get('gid');
$table->update();
$user->setLastVisit();
$user = JFactory::getUser();
//Redirect after Login
$session->clear('tmpuser');
?>
<script>
if (window.opener) {
window.opener.location.href='<?php echo JURI::root(); ?>';
window.close();
}
</script>
<?php
}
}
/*
* Function that sends a verification link to exist user.
*/
function _sendMail(&$user, $usermessgae) {
// Compile the notification mail values.
$lr_settings = plgSystemSocialLoginTools::sociallogin_getsettings ();
$config = JFactory::getConfig();
$data = $user->getProperties();
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
$data['siteurl'] = JUri::base();
$uri = JURI::getInstance();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false);
$emailSubject = JText::sprintf('COM_USERS_EMAIL_ACCOUNT_DETAILS', $data['name'], $data['sitename']);
if($usermessgae == 1) {
$emailBody = JText::sprintf('COM_SOCIALLOGIN_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'], $data['siteurl'], $data['username'], $data['password_clear']);
}
else if ($usermessgae == 2) {
$emailBody = JText::sprintf('COM_SOCIALLOGIN_SEND_MSG', $data['name'], $data['sitename'], $data['siteurl'].'index.php', $data['username'],$data['password_clear']);
}
else if ($usermessgae == 3) {
$emailBody = JText::sprintf('COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY', $data['name'], $data['sitename'], $data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'], $data['siteurl'], $data['username'], $data['password_clear']);
}
// Send the registration email.
$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody);
// Check for an error.
if ($return !== true) {
$this->setError(JText::_('COM_USERS_REGISTRATION_SEND_MAIL_FAILED'));
// Send a system message to administrators receiving system mails
$db = JFactory::getDBO();
$q = "SELECT id FROM #__users WHERE block = 0 AND sendEmail = 1";
$db->setQuery($q);
$sendEmail = $db->loadColumn();
if (count($sendEmail) > 0) {
$jdate = new JDate();
// Build the query to add the messages
$q = "INSERT INTO `#__messages` (`user_id_from`, `user_id_to`, `date_time`, `subject`, `message`) VALUES ";
$messages = array();
foreach ($sendEmail as $userid) {
$messages[] = "(".$userid.", ".$userid.", '".$jdate->toSql()."', '".JText::_('COM_USERS_MAIL_SEND_FAILURE_SUBJECT')."', '".JText::sprintf('COM_USERS_MAIL_SEND_FAILURE_BODY', $return, $data['username'])."')";
}
$q .= implode(',', $messages);
$db->setQuery($q);
$db->execute();
}
return false;
}
elseif ($usermessgae == 2) {
$db = JFactory::getDBO();
// get all admin users
$query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail=1';
$db->setQuery( $query );
$rows = $db->loadObjectList();
// Send mail to all superadministrators id
foreach ( $rows as $row ) {
JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, JText::sprintf('COM_SOCIALLOGIN_SEND_MSG_ADMIN', $row->name, $data['sitename'], $data['siteurl'], $data['email'], $data['username'], $data['password_clear']));
}
}
return false;
}
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="system">
<name>System - Social Login And Social Share</name>
<license>GNU/GPL</license>
<author>LoginRadius</author>
<authorEmail>developers@loginradius.com</authorEmail>
<authorUrl>http://www.loginradius.com</authorUrl>
<creationDate>2012-01-01</creationDate>
<copyright>2012 to till</copyright>
<version>4.0</version>
<description>
LoginRadius enables social login for your joomla websites.
</description>
<files>
<file plugin="socialloginandsocialshare">socialloginandsocialshare.php</file>
<file>facebooklogin.php</file>
<file>googlelogin.php</file>
<file>socialloginandsocialshare_helper.php</file>
</files>
</extension>

View File

@ -0,0 +1,121 @@
<?php
/*------------------------------------------------------------------------
# mod_SocialLoginandSocialShare
# ------------------------------------------------------------------------
# author LoginRadius inc.
# copyright Copyright (C) 2013 loginradius.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.loginradius.com
# Technical Support: Forum - http://community.loginradius.com/
-------------------------------------------------------------------------*/
// no direct access
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
/**
* SocialLogin plugin helper class.
*/
class plgSystemSocialLoginTools {
/*
* get user profile data from given url
*/
public static function open_http($url, $method = false, $params = null)
{
if (!function_exists('curl_init')) {
die('ERROR: CURL library not found!');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $method);
if ($method == true && isset($params)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Length: '.strlen($params),
'Cache-Control: no-store, no-cache, must-revalidate',
"Expires: " . date("r")
));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
/**
* Get the databse settings.
*/
public static function sociallogin_getsettings () {
$lr_settings = array ();
$db = JFactory::getDBO ();
$sql = "SELECT * FROM #__loginradius_settings";
$db->setQuery ($sql);
$rows = $db->LoadAssocList ();
if (is_array ($rows)) {
foreach ($rows AS $key => $data) {
$lr_settings [$data ['setting']] = $data ['value'];
}
}
return $lr_settings;
}
/*
* Function that remove unescaped char from string.
*/
public static function remove_unescapedChar($str) {
$in_str = str_replace(array('<', '>', '&', '{', '}', '*', '/', '(', '[', ']' , '@', '!', ')', '&', '*', '#', '$', '%', '^', '|','?', '+', '=','"',','), array(''), $str);
$cur_encoding = mb_detect_encoding($in_str) ;
if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8"))
return $in_str;
else
return utf8_encode($in_str);
}
/*
* Function that checking username exist then adding index to it.
*/
public static function get_exist_username($username) {
$nameexists = true;
$index = 0;
$userName = $username;
while ($nameexists == true) {
if(JUserHelper::getUserId($userName) != 0) {
$index++;
$userName = $username.$index;
}
else{
$nameexists = false;
}
}
return $userName;
}
/*
* Function filter the username.
*/
public static function get_filter_username($lrdata) {
if (!empty($lrdata['FullName'])) {
$username = $lrdata['FullName'];
}
elseif (!empty($lrdata['ProfileName'])) {
$username = $lrdata['ProfileName'];
}
elseif (!empty($lrdata['NickName'])) {
$username = $lrdata['NickName'];
}
elseif (!empty($lrdata['email'])) {
$user_name = explode('@',$lrdata['email']);
$username = $user_name[0];
}
else {
$username = $lrdata['id'];
}
return $username;
}
}