diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/css/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/css/index.html new file mode 100644 index 00000000..0e44bd0e --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/css/index.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/css/socialloginandsocialshare.css b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/css/socialloginandsocialshare.css new file mode 100644 index 00000000..b9c6c869 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/css/socialloginandsocialshare.css @@ -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; +} \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/img/configuration.gif b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/img/configuration.gif new file mode 100644 index 00000000..592b10d8 Binary files /dev/null and b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/img/configuration.gif differ diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/index.html new file mode 100644 index 00000000..0e44bd0e --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/assets/index.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/controller.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/controller.php new file mode 100644 index 00000000..f7067c92 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/controller.php @@ -0,0 +1,74 @@ +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)); + } + +} diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/index.html new file mode 100644 index 00000000..0e44bd0e --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/index.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/install.mysql.utf8.sql b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/install.mysql.utf8.sql new file mode 100644 index 00000000..d11adf75 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/install.mysql.utf8.sql @@ -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; \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/script_socialloginandsocialshare.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/script_socialloginandsocialshare.php new file mode 100644 index 00000000..f09bae17 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/install/script_socialloginandsocialshare.php @@ -0,0 +1,299 @@ +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)) {?> +

Social Login And Social Share Installation

+ + + + + + + + + + + + + + + + + + + + + + + +modules)) : ?> + + + + + + modules as $module) : ?> + + + + + + plugins)) : ?> + + + + + + plugins as $plugin) : ?> + + + + + + + +
+ +

+

+ Social Login and Social Share! + Social Login + + +

+ + + Social Login And Social Share + Open Source License, GPL v2 based + LoginRadius + developers@loginradius.com + http://www.loginradius.com + 2012-01-01 + 2013, LoginRadius + 4.0 + + install/script_socialloginandsocialshare.php + + + + + install/install.mysql.utf8.sql + + + + + install/uninstall.mysql.utf8.sql + + + + + index.html + images + + + + + COM_SOCIALLOGINANDSOCIALSHARE + + assets + install + models + views + index.html + controller.php + socialloginandsocialshare.php + + + en-GB/en-GB.com_socialloginandsocialshare.ini + en-GB/en-GB.com_socialloginandsocialshare.sys.ini + + + + en-GB/en-GB.com_socialloginandsocialshare.ini + en-GB/en-GB.mod_socialloginandsocialshare.ini + en-GB/en-GB.mod_socialloginandsocialshare.sys.ini + + + + + + + mod_socialloginandsocialshare.php + mod_socialloginandsocialshare.xml + helper.php + index.html + tmpl/default.php + images/lr_provider_sprite.png + tmpl/index.html + + + + + + + + + + + socialloginandsocialshare.php + facebooklogin.php + googlelogin.php + socialloginandsocialshare_helper.php + socialloginandsocialshare.xml + + + + + socialshare.php + socialshare.xml + + + + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/models/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/models/index.html new file mode 100644 index 00000000..0e44bd0e --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/models/index.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/models/socialloginandsocialshare.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/models/socialloginandsocialshare.php new file mode 100644 index 00000000..fa7072b5 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/models/socialloginandsocialshare.php @@ -0,0 +1,81 @@ +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; + } + } \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/socialloginandsocialshare.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/socialloginandsocialshare.php new file mode 100644 index 00000000..9d415992 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/socialloginandsocialshare.php @@ -0,0 +1,30 @@ +execute (JRequest::getCmd ('task', 'display')); + +// Redirect if set by the controller +$controller->redirect (); diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/index.html new file mode 100644 index 00000000..0e44bd0e --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/index.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default.php new file mode 100644 index 00000000..434de58a --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default.php @@ -0,0 +1,108 @@ + +
+
+
+
+
+
+ +
+
+ +
+
+ +
+ +
+
+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'); + } + +?> + +
+ loadTemplate('facebook');?> + loadTemplate('google');?> +
+endPanel();}?> + + + +startPanel( JText::_('COM_SOCIALLOGIN_PANEL_SHARE'), 'panel2' );} +else{echo JHtml::_('tabs.panel', JText::_('COM_SOCIALLOGIN_PANEL_SHARE'), 'panel2');}?> +
+ loadTemplate('share');?> +
+endPanel();}?> + + +
+
+
+

+
    +
  • +
  • +
  • +
  • +
+
+
+ +
+

+

+

+
    +
  • + +
  • +
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_facebook.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_facebook.php new file mode 100644 index 00000000..e0cc9ea6 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_facebook.php @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_google.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_google.php new file mode 100644 index 00000000..84ca7654 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_google.php @@ -0,0 +1,43 @@ + + + + + + + + + + +
+

+ settings['fbenable']) ? $this->settings['fbenable'] : ""); + if ($fbenable == '0') $fbdisableLogin = "checked='checked'"; + else if ($fbenable == '1') $fbenableLogin = "checked='checked'"; + else $fbenableLogin = "checked='checked'";?> + /> +        + /> +


+ + +
+

+
+

+
+
+
+
+

+ settings['genable']) ? $this->settings['genable'] : ""); + if ($genable == '0') $disableLogin = "checked='checked'"; + else if ($genable == '1') $enableLogin = "checked='checked'"; + else $enableLogin = "checked='checked'";?> + /> +        + /> +
+

+
+ +

+
+
+
+
\ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_share.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_share.php new file mode 100644 index 00000000..e047b0c0 --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/default_share.php @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + +


+ settings['share']) ? $this->settings['share'] : ""); + if ($share == '0') $disableshare = "checked='checked'"; + else if ($share == '1') $enableshare = "checked='checked'"; + else $enableshare = "checked='checked'";?> + /> +        + /> +


+ + +


+ 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'";} + ?> +
+ value="on" style="float: left !important;margin: 0; padding: 0;"/> + +
+
+ value="on" style="float: left !important;margin: 0; padding: 0;" /> + +
+
+ value="on" style="float: left !important;margin: 0; padding: 0;" /> + +
+
+ value="on" style="float: left !important;margin: 0; padding: 0;" /> + +
+


+ 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'";} + ?> +
+ value="on" style="float: left !important;margin: 0; padding: 0;" /> + +
+
+ value="on" style="float: left !important;margin: 0; padding: 0;" /> + +
+
+

+ setQuery($query); + $rows = $db->loadObjectList(); + ?> + settings['articles']) ? $this->settings['articles'] : ""); + $articles = unserialize($articles);?> + +
\ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/index.html b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/index.html new file mode 100644 index 00000000..0e44bd0e --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/tmpl/index.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/view.html.php b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/view.html.php new file mode 100644 index 00000000..796201de --- /dev/null +++ b/deployed/socialloginandsocialshare/administrator/components/com_socialloginandsocialshare/views/socialloginandsocialshare/view.html.php @@ -0,0 +1,56 @@ +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'); + } +} \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/images/favicon.png b/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/images/favicon.png new file mode 100644 index 00000000..1f02750f Binary files /dev/null and b/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/images/favicon.png differ diff --git a/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/images/noimage.png b/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/images/noimage.png new file mode 100644 index 00000000..3a561c66 Binary files /dev/null and b/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/images/noimage.png differ diff --git a/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/index.html b/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/socialloginandsocialshare/media/com_socialloginandsocialshare/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/helper.php b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/helper.php new file mode 100644 index 00000000..1b42de27 --- /dev/null +++ b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/helper.php @@ -0,0 +1,141 @@ +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.'
'; + $sociallink .= '
'; + 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 .= '
';?> +
'; + } + $sociallink .= '
'; + $sociallink .= '
Powered By LoginRadius'; + + return $sociallink; + } +} +?> \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/images/lr_provider_sprite.png b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/images/lr_provider_sprite.png new file mode 100644 index 00000000..3b64d595 Binary files /dev/null and b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/images/lr_provider_sprite.png differ diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/index.html b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/lrstyle.css b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/lrstyle.css new file mode 100644 index 00000000..b4a3a1db --- /dev/null +++ b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/lrstyle.css @@ -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; } diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/mod_socialloginandsocialshare.php b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/mod_socialloginandsocialshare.php new file mode 100644 index 00000000..88d1cd9b --- /dev/null +++ b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/mod_socialloginandsocialshare.php @@ -0,0 +1,22 @@ +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')); \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/mod_socialloginandsocialshare.xml b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/mod_socialloginandsocialshare.xml new file mode 100644 index 00000000..38c0a681 --- /dev/null +++ b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/mod_socialloginandsocialshare.xml @@ -0,0 +1,21 @@ + + + Social Login + 2012-01-01 + LoginRadius + developers@loginradius.com + www.LoginRadius.com + Copyright (C) 2012 - till Open Source Matters. All rights reserved. + GPL 2.0 + 4.0 + LoginRadius enables social login and social share for your joomla websites. + + mod_socialloginandsocialshare.php + helper.php + index.html + lrstyle.css + tmpl/default.php + images/lr_provider_sprite.png + tmpl/index.html + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/tmpl/default.php b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/tmpl/default.php new file mode 100644 index 00000000..0e3b38b4 --- /dev/null +++ b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/tmpl/default.php @@ -0,0 +1,58 @@ + + + + + + +
+
+ get('user_picture');?> +
+<?php echo $user->get('name');?> +
+
+ +
+
+ + + + + +
+
+
+
+ + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/tmpl/index.html b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/deployed/socialloginandsocialshare/modules/mod_socialloginandsocialshare/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/plugins/content/socialshare/socialshare.php b/deployed/socialloginandsocialshare/plugins/content/socialshare/socialshare.php new file mode 100644 index 00000000..e9ec417f --- /dev/null +++ b/deployed/socialloginandsocialshare/plugins/content/socialshare/socialshare.php @@ -0,0 +1,228 @@ +sociallogin_getsettings(); + //Properties holding plugin settings + ?> + + 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 .='
+ '; + if($this->shareontoppos == 'on'){ + $app = JFactory::getApplication(); + if (is_array($this->articles)) { + foreach ($this->articles as $key=>$value) { + if ($article->id == $value) { + $sharetitle = '
'.$this->sharetitle.'
'; + 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 .= "
".$sharetitle."
"; + + + $beforediv .= '
'; + $beforediv .= ' + + + + + + +
'; + if($this->fblike == 'on'){ + $beforediv .= '
'; + } + + $beforediv .= '
'; + if($this->fbsend == 'on'){ + $beforediv .= '
'; + } + $beforediv .= '
'; + if($this->googleplus == 'on'){ + $beforediv .= ''; + } + $beforediv .= ''; + if($this->googleshare == 'on'){ + $beforediv .= ''; + } + $beforediv .= '
'; + $beforediv .= '
'; + + + } + } + } + } + } + return $beforediv; +} + /** + * After display content method + */ + public function onContentAfterDisplay($context, &$article, &$params, $limitstart=0) { + $afterdiv = ''; + if($this->enableshare == '1'){ + $afterdiv .='
+ '; + if($this->shareonbottompos == 'on'){ + $app = JFactory::getApplication(); + if (is_array($this->articles)) { + foreach ($this->articles as $key=>$value) { + if ($article->id == $value) { + $sharetitle = '
'.$this->sharetitle.'
'; + 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 .= "
".$sharetitle."
"; + + + $afterdiv .= '
'; + $afterdiv .= ' + + + + + + +
'; + if($this->fblike == 'on'){ + $afterdiv .= '
'; + } + + $afterdiv .= '
'; + if($this->fbsend == 'on'){ + $afterdiv .= '
'; + } + $afterdiv .= '
'; + if($this->googleplus == 'on'){ + $afterdiv .= ''; + } + $afterdiv .= ''; + if($this->googleshare == 'on'){ + $afterdiv .= ''; + } + $afterdiv .= '
'; + $afterdiv .= '
'; + } + } + } + } + } + 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; + } +} \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/plugins/content/socialshare/socialshare.xml b/deployed/socialloginandsocialshare/plugins/content/socialshare/socialshare.xml new file mode 100644 index 00000000..0de01d4b --- /dev/null +++ b/deployed/socialloginandsocialshare/plugins/content/socialshare/socialshare.xml @@ -0,0 +1,15 @@ + + + Content - Social Share + GNU/GPL + LoginRadius + developers@loginradius.com + http://www.loginradius.com + 2012-01-01 + 2012 to till + 4.0 + LoginRadius enables social share for your joomla websites. + + socialshare.php + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/facebooklogin.php b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/facebooklogin.php new file mode 100644 index 00000000..e4402e3f --- /dev/null +++ b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/facebooklogin.php @@ -0,0 +1,73 @@ +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; + + } +} +?> \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/googlelogin.php b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/googlelogin.php new file mode 100644 index 00000000..a5bee777 --- /dev/null +++ b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/googlelogin.php @@ -0,0 +1,70 @@ +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; + } +} +?> \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare.php b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare.php new file mode 100644 index 00000000..6ea7df3d --- /dev/null +++ b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare.php @@ -0,0 +1,356 @@ +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'); + ?> + + + 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; + } + } \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare.xml b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare.xml new file mode 100644 index 00000000..4cb65cb5 --- /dev/null +++ b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare.xml @@ -0,0 +1,20 @@ + + + System - Social Login And Social Share + GNU/GPL + LoginRadius + developers@loginradius.com + http://www.loginradius.com + 2012-01-01 + 2012 to till + 4.0 + + LoginRadius enables social login for your joomla websites. + + + socialloginandsocialshare.php + facebooklogin.php + googlelogin.php + socialloginandsocialshare_helper.php + + \ No newline at end of file diff --git a/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare_helper.php b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare_helper.php new file mode 100644 index 00000000..01fc1c05 --- /dev/null +++ b/deployed/socialloginandsocialshare/plugins/system/socialloginandsocialshare/socialloginandsocialshare_helper.php @@ -0,0 +1,121 @@ +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; + } +}