feat(pkg): reconcile OneAll to live bytes (Cadline CRM delta)
Reconcile to the vetted live deployed files (byte-truth for HIDS verification). The diff vs the previous commit is the full delta from pristine upstream: line-endings, Joomla-deployed install files, and the Cadline CRM integration in the system plugin (+ default.php blankframe branch). Vetted malware-free; SQLi code-quality follow-up noted in PROVENANCE.md. Signed-off-by: LÁZÁR Imre <imre@illusion.hu> Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
parent
581b17d1ea
commit
882eee42a1
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/assets/css/oneallsociallogin.css
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/assets/css/oneallsociallogin.css
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/assets/js/jquery.js
vendored
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/assets/js/jquery.js
vendored
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/assets/js/oneallsociallogin.js
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/assets/js/oneallsociallogin.js
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/install/install.mysql.utf8.sql
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/install/install.mysql.utf8.sql
Executable file → Normal file
@ -0,0 +1,532 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package OneAll Social Login Component
|
||||||
|
* @copyright Copyright 2011-Today http://www.oneall.com, all rights reserved
|
||||||
|
* @license GNU/GPL 2 or later
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||||||
|
*
|
||||||
|
* The "GNU General Public License" (GPL) is available at
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
|
||||||
|
jimport ('joomla.filesystem.folder');
|
||||||
|
jimport ('joomla.filesystem.file');
|
||||||
|
class Com_OneAllSocialLoginInstallerScript
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The component's name
|
||||||
|
*/
|
||||||
|
protected $_oneallsociallogin_extension = 'com_oneallsociallogin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of extra modules and plugins to install
|
||||||
|
*/
|
||||||
|
private $installation_queue = array(
|
||||||
|
'modules' => array(
|
||||||
|
'site' => array(
|
||||||
|
'oneallsociallogin' => array(
|
||||||
|
'title' => 'Social Login',
|
||||||
|
'position' => 'position-7',
|
||||||
|
'order' => 8,
|
||||||
|
'published' => 1,
|
||||||
|
'language' => '*',
|
||||||
|
'showtitle' => 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'plugins' => array(
|
||||||
|
'system' => array(
|
||||||
|
'oneallsociallogin' => array(
|
||||||
|
'published' => 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs before install, update or discover_install
|
||||||
|
*/
|
||||||
|
public function preflight ($type, $parent)
|
||||||
|
{
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'install' :
|
||||||
|
case 'discover_install' :
|
||||||
|
$this->bugfix_db_function_returned_no_error ();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'update' :
|
||||||
|
$this->bugfix_cannot_build_admin_menus ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only allow to install on Joomla! 3 or later
|
||||||
|
return version_compare (JVERSION, '3', 'ge');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs after install, update or discover_update
|
||||||
|
*/
|
||||||
|
public function postflight ($type, $parent)
|
||||||
|
{
|
||||||
|
// Install sub-extensions
|
||||||
|
$status = $this->install_sub_extensions ($parent);
|
||||||
|
|
||||||
|
// Show the post-installation page
|
||||||
|
$this->render_post_installation ($status, $parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs on uninstallation
|
||||||
|
*/
|
||||||
|
public function uninstall ($parent)
|
||||||
|
{
|
||||||
|
// Uninstall subextensions
|
||||||
|
$status = $this->uninstall_sub_extensions ($parent);
|
||||||
|
|
||||||
|
// Show the post-uninstallation page
|
||||||
|
$this->render_post_uninstallation ($status, $parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the post-installation message
|
||||||
|
*/
|
||||||
|
private function render_post_installation ($status, $parent)
|
||||||
|
{
|
||||||
|
$message = '<br/>Thank you very much for having installed <strong>Social Login</strong>!<br />';
|
||||||
|
$message .= 'Please open the <a href="index.php?option=com_oneallsociallogin">Social Login Configuration</a> to enable this component.<br/><br/>';
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the post-uninstallation message
|
||||||
|
*/
|
||||||
|
private function render_post_uninstallation ($status, $parent)
|
||||||
|
{
|
||||||
|
$message = '<strong>Social Login</strong> has been uninstalled successfully.';
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Joomla! bugfix for "DB function returned no error"
|
||||||
|
*/
|
||||||
|
private function bugfix_db_function_returned_no_error ()
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo ();
|
||||||
|
|
||||||
|
// Fix broken #__assets records
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('id')->from ('#__assets')->where ($db->qn ('name') . ' = ' . $db->q ($this->_oneallsociallogin_extension));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$ids = $db->loadColumn ();
|
||||||
|
|
||||||
|
if (is_array ($ids))
|
||||||
|
{
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->delete ('#__assets')->where ($db->qn ('id') . ' = ' . $db->q ($id));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix broken #__extensions records
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('extension_id')->from ('#__extensions')->where ($db->qn ('element') . ' = ' . $db->q ($this->_oneallsociallogin_extension));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$ids = $db->loadColumn ();
|
||||||
|
|
||||||
|
if (is_array ($ids))
|
||||||
|
{
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->delete ('#__extensions')->where ($db->qn ('extension_id') . ' = ' . $db->q ($id));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix broken #__menu records
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('id')->from ('#__menu')->where ($db->qn ('type') . ' = ' . $db->q ('component'))->where ($db->qn ('menutype') . ' = ' . $db->q ('main'))->where ($db->qn ('link') . ' LIKE ' . $db->q ('index.php?option=' . $this->_oneallsociallogin_extension));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$ids = $db->loadColumn ();
|
||||||
|
|
||||||
|
if (is_array ($ids))
|
||||||
|
{
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->delete ('#__menu')->where ($db->qn ('id') . ' = ' . $db->q ($id));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Joomla! bugfix for "Can not build admin menus"
|
||||||
|
*/
|
||||||
|
private function bugfix_cannot_build_admin_menus ()
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo ();
|
||||||
|
|
||||||
|
// If there are multiple #__extensions record, keep one of them
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('extension_id')->from ('#__extensions')->where ($db->qn ('element') . ' = ' . $db->q ($this->_oneallsociallogin_extension));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$ids = $db->loadColumn ();
|
||||||
|
if (count ($ids) > 1)
|
||||||
|
{
|
||||||
|
asort ($ids);
|
||||||
|
$extension_id = array_shift ($ids); // Keep the oldest id
|
||||||
|
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->delete ('#__extensions')->where ($db->qn ('extension_id') . ' = ' . $db->q ($id));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are multiple assets records, delete all except the oldest one
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('id')->from ('#__assets')->where ($db->qn ('name') . ' = ' . $db->q ($this->_oneallsociallogin_extension));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$ids = $db->loadObjectList ();
|
||||||
|
if (count ($ids) > 1)
|
||||||
|
{
|
||||||
|
asort ($ids);
|
||||||
|
$asset_id = array_shift ($ids); // Keep the oldest id
|
||||||
|
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->delete ('#__assets')->where ($db->qn ('id') . ' = ' . $db->q ($id));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove #__menu records for good measure!
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('id')->from ('#__menu')->where ($db->qn ('type') . ' = ' . $db->q ('component'))->where ($db->qn ('menutype') . ' = ' . $db->q ('main'))->where ($db->qn ('link') . ' LIKE ' . $db->q ('index.php?option=' . $this->_oneallsociallogin_extension));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$ids1 = $db->loadColumn ();
|
||||||
|
if (empty ($ids1))
|
||||||
|
$ids1 = array();
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('id')->from ('#__menu')->where ($db->qn ('type') . ' = ' . $db->q ('component'))->where ($db->qn ('menutype') . ' = ' . $db->q ('main'))->where ($db->qn ('link') . ' LIKE ' . $db->q ('index.php?option=' . $this->_oneallsociallogin_extension . '&%'));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$ids2 = $db->loadColumn ();
|
||||||
|
if (empty ($ids2))
|
||||||
|
$ids2 = array();
|
||||||
|
$ids = array_merge ($ids1, $ids2);
|
||||||
|
if (!empty ($ids))
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->delete ('#__menu')->where ($db->qn ('id') . ' = ' . $db->q ($id));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs subextensions (modules, plugins) bundled with the main extension
|
||||||
|
*/
|
||||||
|
private function install_sub_extensions ($parent)
|
||||||
|
{
|
||||||
|
$src = $parent->getParent ()->getPath ('source');
|
||||||
|
|
||||||
|
$db = JFactory::getDbo ();
|
||||||
|
|
||||||
|
// The subextension installation status
|
||||||
|
$status = new JObject ();
|
||||||
|
$status->modules = array();
|
||||||
|
$status->plugins = array();
|
||||||
|
|
||||||
|
// Modules installation
|
||||||
|
if (isset ($this->installation_queue ['modules']) and is_array ($this->installation_queue ['modules']))
|
||||||
|
{
|
||||||
|
foreach ($this->installation_queue ['modules'] as $folder => $modules)
|
||||||
|
{
|
||||||
|
if (is_array ($modules))
|
||||||
|
{
|
||||||
|
foreach ($modules as $module => $module_preferences)
|
||||||
|
{
|
||||||
|
// Look for the temporary installation folder
|
||||||
|
$path = $src . '/modules/' . $folder . '/' . $module;
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/modules/' . $folder . '/mod_' . $module;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/modules/' . $module;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/modules/mod_' . $module;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/mod_' . $module;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Was the module already installed?
|
||||||
|
$sql = $db->getQuery (true)->select ('COUNT(*)')->from ('#__modules')->where ($db->qn ('module') . ' = ' . $db->q ('mod_' . $module));
|
||||||
|
$db->setQuery ($sql);
|
||||||
|
$count = $db->loadResult ();
|
||||||
|
|
||||||
|
// Install
|
||||||
|
$installer = new JInstaller ();
|
||||||
|
$installer->setOverwrite (true);
|
||||||
|
$result = $installer->install ($path);
|
||||||
|
|
||||||
|
// Store status
|
||||||
|
$status->modules [] = array(
|
||||||
|
'name' => 'mod_' . $module,
|
||||||
|
'client' => $folder,
|
||||||
|
'result' => $result
|
||||||
|
);
|
||||||
|
|
||||||
|
// Modify where it's published and its published state
|
||||||
|
if (!$count)
|
||||||
|
{
|
||||||
|
// Flags
|
||||||
|
$module_position = (isset ($module_preferences ['position']) ? $module_preferences ['position'] : 1);
|
||||||
|
$module_published = (!empty ($module_preferences ['published']));
|
||||||
|
$module_showtitle = (!empty ($module_preferences ['showtitle']));
|
||||||
|
|
||||||
|
// Position
|
||||||
|
$sql = $db->getQuery (true)->update ($db->qn ('#__modules'))->set ($db->qn ('position') . ' = ' . $db->q ($module_position))->where ($db->qn ('module') . ' = ' . $db->q ('mod_' . $module));
|
||||||
|
|
||||||
|
// Published
|
||||||
|
if ($module_published)
|
||||||
|
{
|
||||||
|
$sql->set ($db->qn ('published') . ' = ' . $db->q ('1'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not display the title?
|
||||||
|
if (!$module_showtitle)
|
||||||
|
{
|
||||||
|
$sql->set ($db->qn ('showtitle') . ' = ' . $db->q ('0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->setQuery ($sql);
|
||||||
|
$db->query ();
|
||||||
|
|
||||||
|
// Change the ordering of back-end modules to 1 + max ordering
|
||||||
|
if ($folder == 'admin')
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('MAX(' . $db->qn ('ordering') . ')')->from ($db->qn ('#__modules'))->where ($db->qn ('position') . '=' . $db->q ($module_position));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$position = $db->loadResult ();
|
||||||
|
$position ++;
|
||||||
|
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->update ($db->qn ('#__modules'))->set ($db->qn ('ordering') . ' = ' . $db->q ($position))->where ($db->qn ('module') . ' = ' . $db->q ('mod_' . $module));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Link to all pages
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('id')->from ($db->qn ('#__modules'))->where ($db->qn ('module') . ' = ' . $db->q ('mod_' . $module));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$moduleid = $db->loadResult ();
|
||||||
|
|
||||||
|
$query = $db->getQuery (true);
|
||||||
|
$query->select ('*')->from ($db->qn ('#__modules_menu'))->where ($db->qn ('moduleid') . ' = ' . $db->q ($moduleid));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$assignments = $db->loadObjectList ();
|
||||||
|
|
||||||
|
$isAssigned = !empty ($assignments);
|
||||||
|
if (!$isAssigned)
|
||||||
|
{
|
||||||
|
$o = (object) array(
|
||||||
|
'moduleid' => $moduleid,
|
||||||
|
'menuid' => 0
|
||||||
|
);
|
||||||
|
$db->insertObject ('#__modules_menu', $o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plugins installation
|
||||||
|
if (isset ($this->installation_queue ['plugins']) and is_array ($this->installation_queue ['plugins']))
|
||||||
|
{
|
||||||
|
foreach ($this->installation_queue ['plugins'] as $folder => $plugins)
|
||||||
|
{
|
||||||
|
if (is_array ($plugins))
|
||||||
|
{
|
||||||
|
foreach ($plugins as $plugin => $plugin_preferences)
|
||||||
|
{
|
||||||
|
// Look for the temporary installation folder
|
||||||
|
$path = $src . '/plugins/' . $folder . '/$plugin';
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/plugins/' . $folder . '/plg_' . $plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/plugins/' . $plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/plugins/plg_' . $plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
$path = $src . '/plg_' . $plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir ($path))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Was the plugin already installed?
|
||||||
|
$query = $db->getQuery (true)->select ('COUNT(*)')->from ($db->qn ('#__extensions'))->where ($db->qn ('element') . ' = ' . $db->q ($plugin))->where ($db->qn ('folder') . ' = ' . $db->q ($folder));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$count = $db->loadResult ();
|
||||||
|
|
||||||
|
// Install
|
||||||
|
$installer = new JInstaller ();
|
||||||
|
$result = $installer->install ($path);
|
||||||
|
|
||||||
|
// Store status
|
||||||
|
$status->plugins [] = array(
|
||||||
|
'name' => 'plg_' . $plugin,
|
||||||
|
'group' => $folder,
|
||||||
|
'result' => $result
|
||||||
|
);
|
||||||
|
|
||||||
|
// Publish plugin
|
||||||
|
if (!empty ($plugin_preferences ['published']) && !$count)
|
||||||
|
{
|
||||||
|
$query = $db->getQuery (true)->update ($db->qn ('#__extensions'))->set ($db->qn ('enabled') . ' = ' . $db->q ('1'))->where ($db->qn ('element') . ' = ' . $db->q ($plugin))->where ($db->qn ('folder') . ' = ' . $db->q ($folder));
|
||||||
|
$db->setQuery ($query);
|
||||||
|
$db->query ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uninstalls subextensions (modules, plugins) bundled with the main extension
|
||||||
|
*/
|
||||||
|
private function uninstall_sub_extensions ($parent)
|
||||||
|
{
|
||||||
|
jimport ('joomla.installer.installer');
|
||||||
|
|
||||||
|
// Database handler
|
||||||
|
$db = JFactory::getDBO ();
|
||||||
|
|
||||||
|
// Uninstall status
|
||||||
|
$status = new JObject ();
|
||||||
|
$status->modules = array();
|
||||||
|
$status->plugins = array();
|
||||||
|
|
||||||
|
// Modules uninstallation
|
||||||
|
if (isset ($this->installation_queue ['modules']) and is_array ($this->installation_queue ['modules']))
|
||||||
|
{
|
||||||
|
foreach ($this->installation_queue ['modules'] as $folder => $modules)
|
||||||
|
{
|
||||||
|
if (is_array ($modules))
|
||||||
|
{
|
||||||
|
foreach ($modules as $module => $module_preferences)
|
||||||
|
{
|
||||||
|
// Find the module ID
|
||||||
|
$sql = $db->getQuery (true)->select ($db->qn ('extension_id'))->from ($db->qn ('#__extensions'))->where ($db->qn ('element') . ' = ' . $db->q ('mod_' . $module))->where ($db->qn ('type') . ' = ' . $db->q ('module'));
|
||||||
|
$db->setQuery ($sql);
|
||||||
|
$id = $db->loadResult ();
|
||||||
|
|
||||||
|
// Uninstall the module
|
||||||
|
if ($id)
|
||||||
|
{
|
||||||
|
$installer = new JInstaller ();
|
||||||
|
$result = $installer->uninstall ('module', $id, 1);
|
||||||
|
$status->modules [] = array(
|
||||||
|
'name' => 'mod_' . $module,
|
||||||
|
'client' => $folder,
|
||||||
|
'result' => $result
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Plugins uninstallation
|
||||||
|
if (isset ($this->installation_queue ['plugins']) and is_array ($this->installation_queue ['plugins']))
|
||||||
|
{
|
||||||
|
foreach ($this->installation_queue ['plugins'] as $folder => $plugins)
|
||||||
|
{
|
||||||
|
if (is_array ($plugins))
|
||||||
|
{
|
||||||
|
foreach ($plugins as $plugin => $plugin_preferences)
|
||||||
|
{
|
||||||
|
// Find the plugin ID
|
||||||
|
$sql = $db->getQuery (true)->select ($db->qn ('extension_id'))->from ($db->qn ('#__extensions'))->where ($db->qn ('type') . ' = ' . $db->q ('plugin'))->where ($db->qn ('element') . ' = ' . $db->q ($plugin))->where ($db->qn ('folder') . ' = ' . $db->q ($folder));
|
||||||
|
$db->setQuery ($sql);
|
||||||
|
$id = $db->loadResult ();
|
||||||
|
|
||||||
|
// Uninstall the plugin
|
||||||
|
if ($id)
|
||||||
|
{
|
||||||
|
$installer = new JInstaller ();
|
||||||
|
$result = $installer->uninstall ('plugin', $id, 1);
|
||||||
|
$status->plugins [] = array(
|
||||||
|
'name' => 'plg_' . $plugin,
|
||||||
|
'group' => $folder,
|
||||||
|
'result' => $result
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
}
|
||||||
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/install/uninstall.mysql.utf8.sql
Executable file → Normal file
0
packages/oneallsociallogin/administrator/components/com_oneallsociallogin/install/uninstall.mysql.utf8.sql
Executable file → Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="component" version="3" method="upgrade">
|
||||||
|
<name>OneAll Social Login</name>
|
||||||
|
<license>Open Source License, GPL v2 based</license>
|
||||||
|
<author>OneAll LLC</author>
|
||||||
|
<authorEmail>support@oneall.com</authorEmail>
|
||||||
|
<authorUrl>http://www.oneall.com</authorUrl>
|
||||||
|
<creationDate>2014-10-29</creationDate>
|
||||||
|
<copyright>2011 - Today, OneAll LLC</copyright>
|
||||||
|
<version>5.5.0</version>
|
||||||
|
<description>
|
||||||
|
<![CDATA[Social Login allows your users to register and login with 40+ social networks like for example Twitter, Facebook, Paypal, LinkedIn, LiveJournal, OpenID, VKontakte, Google and Yahoo amongst others.]]>
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<!-- SQL query files to execute on installation -->
|
||||||
|
<install>
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">install/install.mysql.utf8.sql</file>
|
||||||
|
</sql>
|
||||||
|
</install>
|
||||||
|
|
||||||
|
<!-- SQL query files to execute on uninstallation -->
|
||||||
|
<uninstall>
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">install/uninstall.mysql.utf8.sql</file>
|
||||||
|
</sql>
|
||||||
|
</uninstall>
|
||||||
|
<scriptfile>install/script.oneallsociallogin.php</scriptfile>
|
||||||
|
|
||||||
|
<!-- Component -->
|
||||||
|
<files folder="com_oneallsociallogin">
|
||||||
|
<file>index.html</file>
|
||||||
|
<file>oneallsociallogin.php</file>
|
||||||
|
</files>
|
||||||
|
|
||||||
|
<!-- Administration -->
|
||||||
|
<administration>
|
||||||
|
<menu>COM_ONEALLSOCIALLOGIN</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>oneallsociallogin.php</file>
|
||||||
|
</files>
|
||||||
|
<languages folder="admin/language">
|
||||||
|
<language tag="en-GB">en-GB.com_oneallsociallogin.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</administration>
|
||||||
|
|
||||||
|
<!-- Modules -->
|
||||||
|
<modules>
|
||||||
|
<module module="mod_oneallsociallogin" title="OneAll Social Login" position="position-7" order="8" client="site" language="*" showtitle="0">
|
||||||
|
<files folder="mod_oneallsociallogin">
|
||||||
|
<folder>classes</folder>
|
||||||
|
<folder>tmpl</folder>
|
||||||
|
<file>index.html</file>
|
||||||
|
<file>mod_oneallsociallogin.php</file>
|
||||||
|
<file>mod_oneallsociallogin.xml</file>
|
||||||
|
</files>
|
||||||
|
</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<!-- Plugins -->
|
||||||
|
<plugins>
|
||||||
|
<plugin plugin="oneallsociallogin" title="OneAll Social Login" order="-100" group="system">
|
||||||
|
<files folder="plg_oneallsociallogin">
|
||||||
|
<file>index.html</file>
|
||||||
|
<file>helper.php</file>
|
||||||
|
<file>oneallsociallogin.php</file>
|
||||||
|
<file>oneallsociallogin.xml</file>
|
||||||
|
</files>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</extension>
|
||||||
0
packages/oneallsociallogin/administrator/language/en-GB/en-GB.com_oneallsociallogin.sys.ini
Executable file → Normal file
0
packages/oneallsociallogin/administrator/language/en-GB/en-GB.com_oneallsociallogin.sys.ini
Executable file → Normal file
@ -1 +0,0 @@
|
|||||||
<html><body bgcolor="#fff"></body></html>
|
|
||||||
0
packages/oneallsociallogin/modules/mod_oneallsociallogin/mod_oneallsociallogin.xml
Executable file → Normal file
0
packages/oneallsociallogin/modules/mod_oneallsociallogin/mod_oneallsociallogin.xml
Executable file → Normal file
@ -24,6 +24,9 @@
|
|||||||
*/
|
*/
|
||||||
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
|
defined ('_JEXEC') or die ('Direct Access to this location is not allowed.');
|
||||||
|
|
||||||
|
$_GET["source"] = isset($_GET["source"]) ? $_GET["source"] : "";
|
||||||
|
|
||||||
|
if($_GET["source"] != "blankframe") {
|
||||||
// User is logged in
|
// User is logged in
|
||||||
if ($user_status == 'logout')
|
if ($user_status == 'logout')
|
||||||
{
|
{
|
||||||
@ -90,7 +93,7 @@ else
|
|||||||
var _oneall = _oneall || [];
|
var _oneall = _oneall || [];
|
||||||
_oneall.push(['social_login', 'set_providers', ['<?php echo implode ("','", $widget_settings['providers']); ?>']]);
|
_oneall.push(['social_login', 'set_providers', ['<?php echo implode ("','", $widget_settings['providers']); ?>']]);
|
||||||
_oneall.push(['social_login', 'set_callback_uri', '<?php echo $return_url; ?>']);
|
_oneall.push(['social_login', 'set_callback_uri', '<?php echo $return_url; ?>']);
|
||||||
_oneall.push(['social_login', 'set_custom_css_uri', '<?php echo $widget_settings['css_theme_uri']; ?>']);
|
_oneall.push(['social_login', 'set_custom_css_uri', 'https://secure.oneallcdn.com/css/api/themes/flat_w188_h32_wc_v1.css']);
|
||||||
_oneall.push(['social_login', 'do_render_ui', 'oa_social_login_container<?php echo $rnd.$moduleclass_sfx ?>']);
|
_oneall.push(['social_login', 'do_render_ui', 'oa_social_login_container<?php echo $rnd.$moduleclass_sfx ?>']);
|
||||||
</script>
|
</script>
|
||||||
<!-- http://www.oneall.com / OneAll Social Login for Joomla! -->
|
<!-- http://www.oneall.com / OneAll Social Login for Joomla! -->
|
||||||
@ -115,3 +118,4 @@ else
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package OneAll Social Login Plugin
|
* @package OneAll Social Login Plugin
|
||||||
* @copyright Copyright 2011-Today http://www.oneall.com, all rights reserved
|
* @copyright Copyright 2011-Today http://www.oneall.com, all rights reserved
|
||||||
@ -27,14 +28,12 @@ jimport('joomla.plugin.plugin');
|
|||||||
jimport('joomla.filesystem.file');
|
jimport('joomla.filesystem.file');
|
||||||
|
|
||||||
// Directory Separator
|
// Directory Separator
|
||||||
if (!defined('DS'))
|
if (!defined('DS')) {
|
||||||
{
|
|
||||||
define('DS', defined('DIRECTORY_SEPARATOR') ? DIRECTORY_SEPARATOR : '/');
|
define('DS', defined('DIRECTORY_SEPARATOR') ? DIRECTORY_SEPARATOR : '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if plugin correctly installed
|
// Check if plugin correctly installed
|
||||||
if (!JFile::exists(dirname(__FILE__) . DS . 'helper.php'))
|
if (!JFile::exists(dirname(__FILE__) . DS . 'helper.php')) {
|
||||||
{
|
|
||||||
JError::raiseNotice('no_oneallsociallogin_plugin', JText::_('The OneAll Social Login plugin is not installed correctly. Plugin not executed'));
|
JError::raiseNotice('no_oneallsociallogin_plugin', JText::_('The OneAll Social Login plugin is not installed correctly. Plugin not executed'));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -53,8 +52,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$settings = plgSystemOneAllSocialLoginHelper::getSettings();
|
$settings = plgSystemOneAllSocialLoginHelper::getSettings();
|
||||||
|
|
||||||
// Check settings
|
// Check settings
|
||||||
if (empty($settings['api_subdomain']) or empty($settings['api_key']) or empty($settings['api_secret']))
|
if (empty($settings['api_subdomain']) or empty($settings['api_key']) or empty($settings['api_secret'])) {
|
||||||
{
|
|
||||||
JError::raiseNotice('no_oneallsociallogin_plugin', JText::_('The OneAll Social Login API settings are missing. Please correct these in the Joomla administration area.'));
|
JError::raiseNotice('no_oneallsociallogin_plugin', JText::_('The OneAll Social Login API settings are missing. Please correct these in the Joomla administration area.'));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -62,8 +60,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
|
|
||||||
// Read user data
|
// Read user data
|
||||||
$social_data = plgSystemOneAllSocialLoginHelper::makeTokenLookup($token);
|
$social_data = plgSystemOneAllSocialLoginHelper::makeTokenLookup($token);
|
||||||
if (is_object($social_data))
|
if (is_object($social_data)) {
|
||||||
{
|
|
||||||
$identity = $social_data->response->result->data->user->identity;
|
$identity = $social_data->response->result->data->user->identity;
|
||||||
$user_token = $social_data->response->result->data->user->user_token;
|
$user_token = $social_data->response->result->data->user->user_token;
|
||||||
|
|
||||||
@ -72,93 +69,66 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$user_identity_provider = $identity->source->name;
|
$user_identity_provider = $identity->source->name;
|
||||||
|
|
||||||
// ***** Firstname *****
|
// ***** Firstname *****
|
||||||
if (isset($identity->name->givenName) and !empty($identity->name->givenName))
|
if (isset($identity->name->givenName) and !empty($identity->name->givenName)) {
|
||||||
{
|
|
||||||
$user_first_name = $identity->name->givenName;
|
$user_first_name = $identity->name->givenName;
|
||||||
}
|
} elseif (isset($identity->preferredUsername)) {
|
||||||
elseif (isset($identity->preferredUsername))
|
|
||||||
{
|
|
||||||
$user_first_name = $identity->preferredUsername;
|
$user_first_name = $identity->preferredUsername;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user_first_name = 'noname';
|
$user_first_name = 'noname';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Lastname *****
|
// ***** Lastname *****
|
||||||
if (isset($identity->name->familyName) and !empty($identity->name->familyName))
|
if (isset($identity->name->familyName) and !empty($identity->name->familyName)) {
|
||||||
{
|
|
||||||
$user_last_name = $identity->name->familyName;
|
$user_last_name = $identity->name->familyName;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user_last_name = '';
|
$user_last_name = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Fullname *****
|
// ***** Fullname *****
|
||||||
if (!empty($identity->name->formatted))
|
if (!empty($identity->name->formatted)) {
|
||||||
{
|
|
||||||
$user_full_name = $identity->name->formatted;
|
$user_full_name = $identity->name->formatted;
|
||||||
}
|
} elseif (!empty($identity->name->displayName)) {
|
||||||
elseif (!empty($identity->name->displayName))
|
|
||||||
{
|
|
||||||
$user_full_name = $identity->name->displayName;
|
$user_full_name = $identity->name->displayName;
|
||||||
}
|
} else {
|
||||||
else
|
if ($_SERVER['HTTP_HOST'] == "www.archlinexp.com")
|
||||||
{
|
|
||||||
$user_full_name = trim($user_first_name . ' ' . $user_last_name);
|
$user_full_name = trim($user_first_name . ' ' . $user_last_name);
|
||||||
|
else
|
||||||
|
$user_full_name = trim($user_last_name . ' ' . $user_first_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Email *****
|
// ***** Email *****
|
||||||
$user_email = '';
|
$user_email = '';
|
||||||
if (property_exists($identity, 'emails') and is_array($identity->emails))
|
if (property_exists($identity, 'emails') and is_array($identity->emails)) {
|
||||||
{
|
foreach ($identity->emails as $email) {
|
||||||
foreach ($identity->emails as $email)
|
|
||||||
{
|
|
||||||
$user_email = $email->value;
|
$user_email = $email->value;
|
||||||
$user_email_is_verified = ($email->is_verified == '1');
|
$user_email_is_verified = ($email->is_verified == '1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Thumbnail *****
|
// ***** Thumbnail *****
|
||||||
if (property_exists($identity, 'thumbnailUrl') and !empty($identity->thumbnailUrl))
|
if (property_exists($identity, 'thumbnailUrl') and !empty($identity->thumbnailUrl)) {
|
||||||
{
|
|
||||||
$user_thumbnail = trim($identity->thumbnailUrl);
|
$user_thumbnail = trim($identity->thumbnailUrl);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user_thumbnail = '';
|
$user_thumbnail = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** User Website *****
|
// ***** User Website *****
|
||||||
if (property_exists($identity, 'profileUrl') and !empty($identity->profileUrl))
|
if (property_exists($identity, 'profileUrl') and !empty($identity->profileUrl)) {
|
||||||
{
|
|
||||||
$user_website = $identity->profileUrl;
|
$user_website = $identity->profileUrl;
|
||||||
}
|
} elseif (property_exists($identity, 'urls') and !empty($identity->urls[0]->value)) {
|
||||||
elseif (property_exists($identity, 'urls') and !empty($identity->urls[0]->value))
|
|
||||||
{
|
|
||||||
$user_website = $identity->urls[0]->value;
|
$user_website = $identity->urls[0]->value;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user_website = '';
|
$user_website = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Preferred Username *****
|
// ***** Preferred Username *****
|
||||||
if (!empty($identity->preferredUsername))
|
if (!empty($identity->preferredUsername)) {
|
||||||
{
|
|
||||||
$user_login = $identity->preferredUsername;
|
$user_login = $identity->preferredUsername;
|
||||||
}
|
} elseif (!empty($identity->displayName)) {
|
||||||
elseif (!empty($identity->displayName))
|
|
||||||
{
|
|
||||||
$user_login = $identity->displayName;
|
$user_login = $identity->displayName;
|
||||||
}
|
} elseif (!empty($identity->name->formatted)) {
|
||||||
elseif (!empty($identity->name->formatted))
|
|
||||||
{
|
|
||||||
$user_login = $identity->name->formatted;
|
$user_login = $identity->name->formatted;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$user_login = '';
|
$user_login = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,22 +136,16 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$user_id = plgSystemOneAllSocialLoginHelper::getUserIdForToken($user_token);
|
$user_id = plgSystemOneAllSocialLoginHelper::getUserIdForToken($user_token);
|
||||||
|
|
||||||
// Not linked, try to link to existing account
|
// Not linked, try to link to existing account
|
||||||
if (!is_numeric($user_id))
|
if (!is_numeric($user_id)) {
|
||||||
{
|
|
||||||
// Linking enabled?
|
// Linking enabled?
|
||||||
if (!empty($settings['link_verified_accounts']))
|
if (!empty($settings['link_verified_accounts'])) {
|
||||||
{
|
|
||||||
// Only of email is verified
|
// Only of email is verified
|
||||||
if (!empty($user_email) and $user_email_is_verified === true)
|
if (!empty($user_email) and $user_email_is_verified === true) {
|
||||||
{
|
|
||||||
// Read existing user
|
// Read existing user
|
||||||
if (($user_id_tmp = plgSystemOneAllSocialLoginHelper::getUserIdForEmail($user_email)) !== false)
|
if (($user_id_tmp = plgSystemOneAllSocialLoginHelper::getUserIdForEmail($user_email)) !== false) {
|
||||||
{
|
|
||||||
// Link user to token
|
// Link user to token
|
||||||
if (is_numeric($user_id_tmp))
|
if (is_numeric($user_id_tmp)) {
|
||||||
{
|
if (plgSystemOneAllSocialLoginHelper::setUserIdForToken($user_token, $user_id_tmp)) {
|
||||||
if (plgSystemOneAllSocialLoginHelper::setUserIdForToken($user_token, $user_id_tmp))
|
|
||||||
{
|
|
||||||
$user_id = $user_id_tmp;
|
$user_id = $user_id_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,8 +155,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ***** New User *****
|
// ***** New User *****
|
||||||
if (!is_numeric($user_id))
|
if (!is_numeric($user_id)) {
|
||||||
{
|
|
||||||
// Import libraries
|
// Import libraries
|
||||||
jimport('joomla.user.helper');
|
jimport('joomla.user.helper');
|
||||||
jimport('joomla.application.component.helper');
|
jimport('joomla.application.component.helper');
|
||||||
@ -204,8 +167,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$usersParams = JComponentHelper::getParams('com_users');
|
$usersParams = JComponentHelper::getParams('com_users');
|
||||||
|
|
||||||
// Make sure user registration is allowed.
|
// Make sure user registration is allowed.
|
||||||
if ($usersParams->get('allowUserRegistration') == '0' && !$usersParams->get('override_allow_user_registration', 0))
|
if ($usersParams->get('allowUserRegistration') == '0' && !$usersParams->get('override_allow_user_registration', 0)) {
|
||||||
{
|
|
||||||
JFactory::getApplication()->enqueueMessage(JText::_('Sorry, but your account could not be created as the registration of new users has been disabled by the administrator of this website.'), 'error');
|
JFactory::getApplication()->enqueueMessage(JText::_('Sorry, but your account could not be created as the registration of new users has been disabled by the administrator of this website.'), 'error');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -217,18 +179,15 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$user_login = trim(trim($user_login), '.');
|
$user_login = trim(trim($user_login), '.');
|
||||||
|
|
||||||
// Username must be at least 2 characters long
|
// Username must be at least 2 characters long
|
||||||
if (strlen($user_login) < 2)
|
if (strlen($user_login) < 2) {
|
||||||
{
|
|
||||||
$user_login = $user_identity_provider . 'User';
|
$user_login = $user_identity_provider . 'User';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Username must be unique
|
// Username must be unique
|
||||||
if (plgSystemOneAllSocialLoginHelper::usernameExists($user_login))
|
if (plgSystemOneAllSocialLoginHelper::usernameExists($user_login)) {
|
||||||
{
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$user_login_tmp = $user_login;
|
$user_login_tmp = $user_login;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
$user_login_tmp = $user_login . ($i++);
|
$user_login_tmp = $user_login . ($i++);
|
||||||
} while (plgSystemOneAllSocialLoginHelper::usernameExists($user_login_tmp));
|
} while (plgSystemOneAllSocialLoginHelper::usernameExists($user_login_tmp));
|
||||||
|
|
||||||
@ -237,8 +196,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Email must be unique
|
// Email must be unique
|
||||||
if (empty($user_email) or plgSystemOneAllSocialLoginHelper::useremailExists($user_email))
|
if (empty($user_email) or plgSystemOneAllSocialLoginHelper::useremailExists($user_email)) {
|
||||||
{
|
|
||||||
$user_email = plgSystemOneAllSocialLoginHelper::getRandomUseremail();
|
$user_email = plgSystemOneAllSocialLoginHelper::getRandomUseremail();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,8 +211,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
|
|
||||||
// Get the default usertype
|
// Get the default usertype
|
||||||
$defaultUserGroups = $usersParams->get('new_usertype', 2);
|
$defaultUserGroups = $usersParams->get('new_usertype', 2);
|
||||||
if (!$defaultUserGroups)
|
if (!$defaultUserGroups) {
|
||||||
{
|
|
||||||
$defaultUserGroups = 'Registered';
|
$defaultUserGroups = 'Registered';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,16 +231,14 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$data['block'] = 0;
|
$data['block'] = 0;
|
||||||
|
|
||||||
// Bind the data to the JUser Object
|
// Bind the data to the JUser Object
|
||||||
if (!$user->bind($data))
|
if (!$user->bind($data)) {
|
||||||
{
|
|
||||||
JError::raiseWarning('', JText::_('Could not bind data to user') . ': ' . JText::_($user->getError()));
|
JError::raiseWarning('', JText::_('Could not bind data to user') . ': ' . JText::_($user->getError()));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the user
|
// Save the user
|
||||||
if (!$user->save())
|
if (!$user->save()) {
|
||||||
{
|
|
||||||
JError::raiseWarning('', JText::_('Could not create user') . ': ' . JText::_($user->getError()));
|
JError::raiseWarning('', JText::_('Could not create user') . ': ' . JText::_($user->getError()));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -292,22 +247,81 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
// Store userid
|
// Store userid
|
||||||
$user_id = $user->get('id');
|
$user_id = $user->get('id');
|
||||||
|
|
||||||
|
if ($_SERVER['HTTP_HOST'] == "www.archlinexp.com") {
|
||||||
|
$old_db = "clusers_eng";
|
||||||
|
$info = "Web registration";
|
||||||
|
$topic = 219;
|
||||||
|
} else {
|
||||||
|
$old_db = "clusers";
|
||||||
|
$info = "Weben regisztrált";
|
||||||
|
$topic = 362;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select('nUserID')->from('cl_hlusers.u_emails')->where('email = "' . $data['email'] . '"');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$existedEmail = $db->loadObject();
|
||||||
|
|
||||||
|
if (empty($existedEmail)) {
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select('ctrID')->from('cl_hlusers.countries')->where('ctrNameEng = "' . $identity->loginLocation->country->long . '"');
|
||||||
|
$db->setQuery($query);
|
||||||
|
$result = $db->loadObject();
|
||||||
|
|
||||||
|
$query = $db->getQuery(false);
|
||||||
|
$query = "INSERT INTO cl_hlusers.users(strName, strEmail, dateInsert, old_db, nCtrID)
|
||||||
|
VALUES('" . $data['name'] . "', '" . $data['email'] . "', '" . time() . "', '" . $old_db . "'," . $result->ctrID . ")";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
$nUserID = $db->insertid();
|
||||||
|
|
||||||
|
$query = "INSERT INTO cl_hlusers.u_emails(email, nUserID)
|
||||||
|
VALUES('" . $data['email'] . "', '" . $nUserID . "')";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->update("cl_hlusers.u_emails");
|
||||||
|
$query->set('u_emails.default = 1');
|
||||||
|
$query->where('nUserID = ' . $nUserID);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
|
$query = $db->getQuery(false);
|
||||||
|
$query = "INSERT INTO cl_hlusers.u_history(nUserID, nTopicID, dateEvent, strPlace, strInfo, nManagerID, insertDate)
|
||||||
|
VALUES(" . $nUserID . ", " . $topic . ", '" . date("Y-m-d", time()) . "', 'web', '" . $info . "', 36, '" . date("Y-m-d H:i:s", time()) . "')";
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
} else {
|
||||||
|
$nUserID = $existedEmail->nUserID;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->update("jml_users");
|
||||||
|
$query->set('nUserID = ' . $nUserID);
|
||||||
|
$query->where('id = ' . $user_id);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
// Link to token
|
// Link to token
|
||||||
plgSystemOneAllSocialLoginHelper::setUserIdForToken($user_token, $user_id);
|
plgSystemOneAllSocialLoginHelper::setUserIdForToken($user_token, $user_id);
|
||||||
|
|
||||||
|
$query = $db->getQuery(false);
|
||||||
|
$query = "UPDATE www_archline_hu.jml_users SET username = '" . $data['email'] . "' WHERE id = " . $user_id;
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
}
|
}
|
||||||
// Returning user
|
// Returning user
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$new_user = false;
|
$new_user = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sucess
|
// Sucess
|
||||||
if (isset($user_id) and is_numeric($user_id) and !empty($user_id))
|
if (isset($user_id) and is_numeric($user_id) and !empty($user_id)) {
|
||||||
{
|
|
||||||
// User exists
|
// User exists
|
||||||
$user = JFactory::getUser($user_id);
|
$user = JFactory::getUser($user_id);
|
||||||
if (is_object($user))
|
if (is_object($user)) {
|
||||||
{
|
|
||||||
// Get the application object.
|
// Get the application object.
|
||||||
$app = JFactory::getApplication();
|
$app = JFactory::getApplication();
|
||||||
$db = JFactory::getDBO();
|
$db = JFactory::getDBO();
|
||||||
@ -316,8 +330,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$result = $db->loadObject();
|
$result = $db->loadObject();
|
||||||
|
|
||||||
// Login user
|
// Login user
|
||||||
if ($result and !empty($result->username))
|
if ($result and !empty($result->username)) {
|
||||||
{
|
|
||||||
JPluginHelper::importPlugin('user');
|
JPluginHelper::importPlugin('user');
|
||||||
|
|
||||||
// Setup options
|
// Setup options
|
||||||
@ -340,19 +353,15 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Setup return url for new users
|
// Setup return url for new users
|
||||||
if ($new_user === true)
|
if ($new_user === true) {
|
||||||
{
|
if (isset($settings['redirect_register_url']) and strlen(trim($settings['redirect_register_url'])) > 0) {
|
||||||
if (isset($settings['redirect_register_url']) and strlen(trim($settings['redirect_register_url'])) > 0)
|
|
||||||
{
|
|
||||||
$session = JFactory::getSession();
|
$session = JFactory::getSession();
|
||||||
$session->set('redirect_url', trim($settings['redirect_register_url']), 'plg_oneallsociallogin');
|
$session->set('redirect_url', trim($settings['redirect_register_url']), 'plg_oneallsociallogin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Setup return url for returning users
|
// Setup return url for returning users
|
||||||
elseif ($new_user === false)
|
elseif ($new_user === false) {
|
||||||
{
|
if (isset($settings['redirect_login_url']) and strlen(trim($settings['redirect_login_url'])) > 0) {
|
||||||
if (isset($settings['redirect_login_url']) and strlen(trim($settings['redirect_login_url'])) > 0)
|
|
||||||
{
|
|
||||||
$session = JFactory::getSession();
|
$session = JFactory::getSession();
|
||||||
$session->set('redirect_url', trim($settings['redirect_login_url']), 'plg_oneallsociallogin');
|
$session->set('redirect_url', trim($settings['redirect_login_url']), 'plg_oneallsociallogin');
|
||||||
}
|
}
|
||||||
@ -368,8 +377,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
$loginResult = $app->triggerEvent('onUserLogin', array((array) $response, $options));
|
$loginResult = $app->triggerEvent('onUserLogin', array((array) $response, $options));
|
||||||
|
|
||||||
$user = \JFactory::getUser();
|
$user = \JFactory::getUser();
|
||||||
if (in_array(false, $loginResult, true) == false)
|
if (in_array(false, $loginResult, true) == false) {
|
||||||
{
|
|
||||||
$options['user'] = $user;
|
$options['user'] = $user;
|
||||||
$options['responseType'] = $response->type;
|
$options['responseType'] = $response->type;
|
||||||
|
|
||||||
@ -378,6 +386,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Done
|
//Done
|
||||||
|
header("Refresh:0");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -392,8 +401,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
public function onAfterInitialise()
|
public function onAfterInitialise()
|
||||||
{
|
{
|
||||||
// Check if we have a connection token
|
// Check if we have a connection token
|
||||||
if (isset($_POST) and !empty($_POST['oa_action']) and $_POST['oa_action'] == 'social_login' and !empty($_POST['connection_token']))
|
if (isset($_POST) and !empty($_POST['oa_action']) and $_POST['oa_action'] == 'social_login' and !empty($_POST['connection_token'])) {
|
||||||
{
|
|
||||||
$this->doAuth($_POST['connection_token']);
|
$this->doAuth($_POST['connection_token']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,8 +416,7 @@ class plgSystemOneAllSocialLogin extends JPlugin
|
|||||||
|
|
||||||
// Check for uri
|
// Check for uri
|
||||||
$redirect_url = $session->get('redirect_url', null, 'plg_oneallsociallogin');
|
$redirect_url = $session->get('redirect_url', null, 'plg_oneallsociallogin');
|
||||||
if (!empty($redirect_url))
|
if (!empty($redirect_url)) {
|
||||||
{
|
|
||||||
// Clear uri
|
// Clear uri
|
||||||
$session->clear('redirect_url', 'plg_oneallsociallogin');
|
$session->clear('redirect_url', 'plg_oneallsociallogin');
|
||||||
|
|
||||||
|
|||||||
0
packages/oneallsociallogin/plugins/system/oneallsociallogin/oneallsociallogin.xml
Executable file → Normal file
0
packages/oneallsociallogin/plugins/system/oneallsociallogin/oneallsociallogin.xml
Executable file → Normal file
Loading…
Reference in New Issue
Block a user