diff --git a/app/administrator/components/com_languages/models/languages.php b/app/administrator/components/com_languages/models/languages.php index 770889f244..67fce9225c 100644 --- a/app/administrator/components/com_languages/models/languages.php +++ b/app/administrator/components/com_languages/models/languages.php @@ -118,7 +118,7 @@ protected function getListQuery() // Join over the asset groups. $query->select('ag.title AS access_level') - ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + ->join('LEFT', '#__users_roles AS ag ON ag.id = a.access'); // Select the language home pages $query->select('l.home AS home') diff --git a/app/administrator/components/com_menus/models/item.php b/app/administrator/components/com_menus/models/item.php index 762c3430fe..522774ba3a 100644 --- a/app/administrator/components/com_menus/models/item.php +++ b/app/administrator/components/com_menus/models/item.php @@ -755,7 +755,7 @@ public function getModules() // Join on the asset groups table. $query->select('ag.title AS access_title') - ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access') + ->join('LEFT', '#__users_roles AS ag ON ag.id = a.access') ->where('a.published >= 0') ->where('a.client_id = 0') ->order('a.position, a.ordering'); diff --git a/app/administrator/components/com_menus/models/items.php b/app/administrator/components/com_menus/models/items.php index 4679fae271..ecc1105d96 100644 --- a/app/administrator/components/com_menus/models/items.php +++ b/app/administrator/components/com_menus/models/items.php @@ -221,7 +221,7 @@ protected function getListQuery() // Join over the asset groups. $query->select('ag.title AS access_level') - ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + ->join('LEFT', '#__users_roles AS ag ON ag.id = a.access'); // Join over the associations. $assoc = JLanguageAssociations::isEnabled(); diff --git a/app/administrator/components/com_menus/models/menu.php b/app/administrator/components/com_menus/models/menu.php index 76df61056e..e624f656cf 100644 --- a/app/administrator/components/com_menus/models/menu.php +++ b/app/administrator/components/com_menus/models/menu.php @@ -260,7 +260,7 @@ public function &getModules() ->select('a.id, a.title, a.params, a.position') ->where('module = ' . $db->quote('mod_menu')) ->select('ag.title AS access_title') - ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + ->join('LEFT', '#__users_roles AS ag ON ag.id = a.access'); $db->setQuery($query); $modules = $db->loadObjectList(); diff --git a/app/administrator/components/com_modules/models/modules.php b/app/administrator/components/com_modules/models/modules.php index 843166a76b..5b1c12145f 100644 --- a/app/administrator/components/com_modules/models/modules.php +++ b/app/administrator/components/com_modules/models/modules.php @@ -239,7 +239,7 @@ protected function getListQuery() // Join over the asset groups. $query->select('ag.title AS access_level') - ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + ->join('LEFT', '#__users_roles AS ag ON ag.id = a.access'); // Join over the module menus $query->select('MIN(mm.menuid) AS pages') diff --git a/app/administrator/components/com_plugins/models/plugins.php b/app/administrator/components/com_plugins/models/plugins.php index 98ddf9617d..380a36a4ed 100644 --- a/app/administrator/components/com_plugins/models/plugins.php +++ b/app/administrator/components/com_plugins/models/plugins.php @@ -216,7 +216,7 @@ protected function getListQuery() // Join over the asset groups. $query->select('ag.title AS access_level') - ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + ->join('LEFT', '#__users_roles AS ag ON ag.id = a.access'); // Filter by access level. if ($access = $this->getState('filter.access')) diff --git a/app/administrator/components/com_users/helpers/users.php b/app/administrator/components/com_users/helpers/users.php index e7d2f038e5..480538085d 100644 --- a/app/administrator/components/com_users/helpers/users.php +++ b/app/administrator/components/com_users/helpers/users.php @@ -125,8 +125,8 @@ public static function getGroups() ->select('a.id AS value') ->select('a.title AS text') ->select('COUNT(DISTINCT b.id) AS level') - ->from('#__usergroups as a') - ->join('LEFT', '#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt') + ->from('#__users_groups as a') + ->join('LEFT', '#__users_groups AS b ON a.lft > b.lft AND a.rgt < b.rgt') ->group('a.id, a.title, a.lft, a.rgt') ->order('a.lft ASC'); $db->setQuery($query); diff --git a/app/administrator/components/com_users/models/debuggroup.php b/app/administrator/components/com_users/models/debuggroup.php index 98bda3e5fe..60711b68b1 100644 --- a/app/administrator/components/com_users/models/debuggroup.php +++ b/app/administrator/components/com_users/models/debuggroup.php @@ -158,7 +158,7 @@ public function getGroup() $db = $this->getDbo(); $query = $db->getQuery(true) ->select('id, title') - ->from('#__usergroups') + ->from('#__users_groups') ->where('id = ' . $groupId); $db->setQuery($query); diff --git a/app/administrator/components/com_users/models/debuguser.php b/app/administrator/components/com_users/models/debuguser.php index ec0251237d..1e8ab92777 100644 --- a/app/administrator/components/com_users/models/debuguser.php +++ b/app/administrator/components/com_users/models/debuguser.php @@ -183,7 +183,7 @@ protected function getListQuery() // Filter the items over the group id if set. if ($groupId = $this->getState('filter.group_id')) { - $query->join('LEFT', '#__user_usergroup_map AS map2 ON map2.user_id = a.id') + $query->join('LEFT', '#__users_groups_users AS map2 ON map2.user_id = a.id') ->where('map2.group_id = ' . (int) $groupId); } diff --git a/app/administrator/components/com_users/models/fields/groupparent.php b/app/administrator/components/com_users/models/fields/groupparent.php index 3956d5e1f0..4dae9118e5 100644 --- a/app/administrator/components/com_users/models/fields/groupparent.php +++ b/app/administrator/components/com_users/models/fields/groupparent.php @@ -42,13 +42,13 @@ protected function getOptions() $user = JFactory::getUser(); $query = $db->getQuery(true) ->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level') - ->from('#__usergroups AS a') - ->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); + ->from('#__users_groups AS a') + ->join('LEFT', $db->quoteName('#__users_groups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); // Prevent parenting to children of this item. if ($id = $this->form->getValue('id')) { - $query->join('LEFT', $db->quoteName('#__usergroups') . ' AS p ON p.id = ' . (int) $id) + $query->join('LEFT', $db->quoteName('#__users_groups') . ' AS p ON p.id = ' . (int) $id) ->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)'); } diff --git a/app/administrator/components/com_users/models/groups.php b/app/administrator/components/com_users/models/groups.php index 5c1e833950..528e99e67a 100644 --- a/app/administrator/components/com_users/models/groups.php +++ b/app/administrator/components/com_users/models/groups.php @@ -120,7 +120,7 @@ public function getItems() // Count the objects in the user group. $query->select('map.group_id, COUNT(DISTINCT map.user_id) AS user_count') - ->from($db->quoteName('#__user_usergroup_map') . ' AS map') + ->from($db->quoteName('#__users_groups_users') . ' AS map') ->where('map.group_id IN (' . implode(',', $groupIds) . ')') ->group('map.group_id'); @@ -171,11 +171,11 @@ protected function getListQuery() 'a.*' ) ); - $query->from($db->quoteName('#__usergroups') . ' AS a'); + $query->from($db->quoteName('#__users_groups') . ' AS a'); // Add the level in the tree. $query->select('COUNT(DISTINCT c2.id) AS level') - ->join('LEFT OUTER', $db->quoteName('#__usergroups') . ' AS c2 ON a.lft > c2.lft AND a.rgt < c2.rgt') + ->join('LEFT OUTER', $db->quoteName('#__users_groups') . ' AS c2 ON a.lft > c2.lft AND a.rgt < c2.rgt') ->group('a.id, a.lft, a.rgt, a.parent_id, a.title'); // Filter the comments over the search string if set. diff --git a/app/administrator/components/com_users/models/levels.php b/app/administrator/components/com_users/models/levels.php index d940e316a0..2e53fff566 100644 --- a/app/administrator/components/com_users/models/levels.php +++ b/app/administrator/components/com_users/models/levels.php @@ -97,7 +97,7 @@ protected function getListQuery() 'a.*' ) ); - $query->from($db->quoteName('#__viewlevels') . ' AS a'); + $query->from($db->quoteName('#__users_roles') . ' AS a'); // Add the level in the tree. $query->group('a.id, a.title, a.ordering, a.rules'); diff --git a/app/administrator/components/com_users/models/user.php b/app/administrator/components/com_users/models/user.php index 59956956bc..9ed9f2178e 100644 --- a/app/administrator/components/com_users/models/user.php +++ b/app/administrator/components/com_users/models/user.php @@ -672,7 +672,7 @@ public function batchUser($group_id, $user_ids, $action) $query = $db->getQuery(true); // Remove users from the group - $query->delete($db->quoteName('#__user_usergroup_map')) + $query->delete($db->quoteName('#__users_groups_users')) ->where($db->quoteName('user_id') . ' IN (' . implode(',', $user_ids) . ')'); // Only remove users from selected group @@ -702,7 +702,7 @@ public function batchUser($group_id, $user_ids, $action) // First, we need to check if the user is already assigned to a group $query->select($db->quoteName('user_id')) - ->from($db->quoteName('#__user_usergroup_map')) + ->from($db->quoteName('#__users_groups_users')) ->where($db->quoteName('group_id') . ' = ' . (int) $group_id); $db->setQuery($query); $users = $db->loadColumn(); @@ -728,7 +728,7 @@ public function batchUser($group_id, $user_ids, $action) return false; } - $query->insert($db->quoteName('#__user_usergroup_map')) + $query->insert($db->quoteName('#__users_groups_users')) ->columns(array($db->quoteName('user_id'), $db->quoteName('group_id'))); $db->setQuery($query); diff --git a/app/administrator/components/com_users/models/users.php b/app/administrator/components/com_users/models/users.php index bd8fcb0015..17172362af 100644 --- a/app/administrator/components/com_users/models/users.php +++ b/app/administrator/components/com_users/models/users.php @@ -193,11 +193,11 @@ public function getItems() // Join over the group mapping table. $query->select('map.user_id, COUNT(map.group_id) AS group_count') - ->from('#__user_usergroup_map AS map') + ->from('#__users_groups_users AS map') ->where('map.user_id IN (' . implode(',', $userIds) . ')') ->group('map.user_id') // Join over the user groups table. - ->join('LEFT', '#__usergroups AS g2 ON g2.id = map.group_id'); + ->join('LEFT', '#__users_groups AS g2 ON g2.id = map.group_id'); $db->setQuery($query); @@ -284,7 +284,7 @@ protected function getListQuery() if ($groupId || isset($groups)) { - $query->join('LEFT', '#__user_usergroup_map AS map2 ON map2.user_id = a.id') + $query->join('LEFT', '#__user_groups_map AS map2 ON map2.user_id = a.id') ->group($db->quoteName(array('a.id', 'a.name', 'a.username', 'a.password', 'a.block', 'a.sendEmail', 'a.registerDate', 'a.lastvisitDate', 'a.activation', 'a.params', 'a.email'))); if ($groupId) @@ -401,8 +401,8 @@ protected function getListQuery() function _getUserDisplayedGroups($user_id) { $db = JFactory::getDbo(); - $query = "SELECT title FROM " . $db->quoteName('#__usergroups') . " ug left join " . - $db->quoteName('#__user_usergroup_map') . " map on (ug.id = map.group_id)" . + $query = "SELECT title FROM " . $db->quoteName('#__users_groups') . " ug left join " . + $db->quoteName('#__users_groups_users') . " map on (ug.id = map.group_id)" . " WHERE map.user_id=" . (int) $user_id; $db->setQuery($query); diff --git a/app/administrator/modules/mod_logged/helper.php b/app/administrator/modules/mod_logged/helper.php index b164f99e94..a2720519c1 100644 --- a/app/administrator/modules/mod_logged/helper.php +++ b/app/administrator/modules/mod_logged/helper.php @@ -33,7 +33,7 @@ public static function getList(&$params) $user = JFactory::getUser(); $query = $db->getQuery(true) ->select('s.time, s.client_id, u.id, u.name, u.username') - ->from('#__session AS s') + ->from('#__users_sessions AS s') ->join('LEFT', '#__users AS u ON s.userid = u.id') ->where('s.guest = 0'); $db->setQuery($query, 0, $params->get('count', 5)); diff --git a/app/administrator/modules/mod_status/mod_status.php b/app/administrator/modules/mod_status/mod_status.php index 1864276a6c..02eb31bfe4 100644 --- a/app/administrator/modules/mod_status/mod_status.php +++ b/app/administrator/modules/mod_status/mod_status.php @@ -17,7 +17,7 @@ // Get the number of back-end logged in users. $query = $db->getQuery(true) ->select('COUNT(session_id)') - ->from('#__session') + ->from('#__users_sessions') ->where('guest = 0 AND client_id = 1'); $db->setQuery($query); @@ -26,7 +26,7 @@ // Get the number of frontend logged in users. $query->clear() ->select('COUNT(session_id)') - ->from('#__session') + ->from('#__users_sessions') ->where('guest = 0 AND client_id = 0'); $db->setQuery($query); diff --git a/install/mysql/schema.sql b/install/mysql/schema.sql index 99348a49f4..36886071a7 100644 --- a/install/mysql/schema.sql +++ b/install/mysql/schema.sql @@ -209,25 +209,6 @@ CREATE TABLE IF NOT EXISTS `schemas` ( PRIMARY KEY (`extension_id`,`version_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `session` --- - -CREATE TABLE IF NOT EXISTS `session` ( - `session_id` varchar(200) NOT NULL DEFAULT '', - `client_id` tinyint(3) unsigned NOT NULL DEFAULT 0, - `guest` tinyint(4) unsigned DEFAULT 1, - `time` varchar(14) DEFAULT '', - `data` mediumtext, - `userid` int(11) DEFAULT 0, - `username` varchar(150) DEFAULT '', - PRIMARY KEY (`session_id`), - KEY `userid` (`userid`), - KEY `time` (`time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- -------------------------------------------------------- @@ -249,25 +230,6 @@ CREATE TABLE IF NOT EXISTS `template_styles` ( -- -------------------------------------------------------- --- --- Table structure for table `usergroups` --- - -CREATE TABLE IF NOT EXISTS `usergroups` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key', - `parent_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Adjacency List Reference Id', - `lft` int(11) NOT NULL DEFAULT 0 COMMENT 'Nested set lft.', - `rgt` int(11) NOT NULL DEFAULT 0 COMMENT 'Nested set rgt.', - `title` varchar(100) NOT NULL DEFAULT '', - PRIMARY KEY (`id`), - UNIQUE KEY `idx_usergroup_parent_title_lookup` (`parent_id`,`title`), - KEY `idx_usergroup_title_lookup` (`title`), - KEY `idx_usergroup_adjacency_lookup` (`parent_id`), - KEY `idx_usergroup_nested_set_lookup` (`lft`,`rgt`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - -- -- Table structure for table `users` -- @@ -294,13 +256,47 @@ CREATE TABLE IF NOT EXISTS `users` ( KEY `email` (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- -------------------------------------------------------- + -- --- Table structure for table `user_keys` +-- Table structure for table `users_groups` -- -CREATE TABLE IF NOT EXISTS `user_keys` ( +CREATE TABLE IF NOT EXISTS `users_groups` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key', + `parent_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Adjacency List Reference Id', + `lft` int(11) NOT NULL DEFAULT 0 COMMENT 'Nested set lft.', + `rgt` int(11) NOT NULL DEFAULT 0 COMMENT 'Nested set rgt.', + `title` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_usergroup_parent_title_lookup` (`parent_id`,`title`), + KEY `idx_usergroup_title_lookup` (`title`), + KEY `idx_usergroup_adjacency_lookup` (`parent_id`), + KEY `idx_usergroup_nested_set_lookup` (`lft`,`rgt`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users_groups_users` +-- + +CREATE TABLE IF NOT EXISTS `users_groups_users` ( + `user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Foreign Key to users.id', + `group_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Foreign Key to usergroups.id', + PRIMARY KEY (`user_id`,`group_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users_keys` +-- + +CREATE TABLE IF NOT EXISTS `users_keys` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` varchar(255) NOT NULL, `token` varchar(255) NOT NULL, @@ -321,7 +317,7 @@ CREATE TABLE IF NOT EXISTS `user_keys` ( -- Table structure for table `user_profiles` -- -CREATE TABLE IF NOT EXISTS `user_profiles` ( +CREATE TABLE IF NOT EXISTS `users_profiles` ( `user_id` int(11) NOT NULL, `profile_key` varchar(100) NOT NULL, `profile_value` text NOT NULL, @@ -332,28 +328,35 @@ CREATE TABLE IF NOT EXISTS `user_profiles` ( -- -------------------------------------------------------- -- --- Table structure for table `user_usergroup_map` +-- Table structure for table `users_roles` -- -CREATE TABLE IF NOT EXISTS `user_usergroup_map` ( - `user_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Foreign Key to users.id', - `group_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Foreign Key to usergroups.id', - PRIMARY KEY (`user_id`,`group_id`) +CREATE TABLE IF NOT EXISTS `users_roles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key', + `title` varchar(100) NOT NULL DEFAULT '', + `ordering` int(11) NOT NULL DEFAULT 0, + `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_assetgroup_title_lookup` (`title`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- --- Table structure for table `viewlevels` +-- Table structure for table `session` -- -CREATE TABLE IF NOT EXISTS `viewlevels` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key', - `title` varchar(100) NOT NULL DEFAULT '', - `ordering` int(11) NOT NULL DEFAULT 0, - `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.', - PRIMARY KEY (`id`), - UNIQUE KEY `idx_assetgroup_title_lookup` (`title`) +CREATE TABLE IF NOT EXISTS `users_session` ( + `session_id` varchar(200) NOT NULL DEFAULT '', + `client_id` tinyint(3) unsigned NOT NULL DEFAULT 0, + `guest` tinyint(4) unsigned DEFAULT 1, + `time` varchar(14) DEFAULT '', + `data` mediumtext, + `userid` int(11) DEFAULT 0, + `username` varchar(150) DEFAULT '', + PRIMARY KEY (`session_id`), + KEY `userid` (`userid`), + KEY `time` (`time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/lib/libraries/cms/application/administrator.php b/lib/libraries/cms/application/administrator.php index f5c349132b..4ec5d65abd 100644 --- a/lib/libraries/cms/application/administrator.php +++ b/lib/libraries/cms/application/administrator.php @@ -357,8 +357,8 @@ protected function render() // Get the JInput object $input = $this->input; - $component = $input->getCmd('option'); - $view = $input->getCmd('view'); + $component = $input->getCmd('option', 'com_users'); + $view = $input->getCmd('view', 'login'); $file = $input->getCmd('tmpl', 'index'); if ($component == 'com_users' && $view == 'login') { diff --git a/lib/libraries/cms/application/cms.php b/lib/libraries/cms/application/cms.php index c8ebb0a7f6..bc6ab4b579 100644 --- a/lib/libraries/cms/application/cms.php +++ b/lib/libraries/cms/application/cms.php @@ -168,7 +168,7 @@ public function checkSession() $query = $db->getQuery(true) ->select($db->quoteName('session_id')) - ->from($db->quoteName('#__session')) + ->from($db->quoteName('#__users_sessions')) ->where($db->quoteName('session_id') . ' = ' . $db->quote($session->getId())); $db->setQuery($query, 0, 1); @@ -181,14 +181,14 @@ public function checkSession() if ($session->isNew()) { - $query->insert($db->quoteName('#__session')) + $query->insert($db->quoteName('#__users_sessions')) ->columns($db->quoteName('session_id') . ', ' . $db->quoteName('client_id') . ', ' . $db->quoteName('time')) ->values($db->quote($session->getId()) . ', ' . (int) $this->getClientId() . ', ' . $db->quote((int) time())); $db->setQuery($query); } else { - $query->insert($db->quoteName('#__session')) + $query->insert($db->quoteName('#__users_sessions')) ->columns( $db->quoteName('session_id') . ', ' . $db->quoteName('client_id') . ', ' . $db->quoteName('guest') . ', ' . $db->quoteName('time') . ', ' . $db->quoteName('userid') . ', ' . $db->quoteName('username') @@ -678,7 +678,7 @@ public function loadSession(JSession $session = null) // The modulus introduces a little entropy, making the flushing less accurate // but fires the query less than half the time. $query = $db->getQuery(true) - ->delete($db->quoteName('#__session')) + ->delete($db->quoteName('#__users_sessions')) ->where($db->quoteName('time') . ' < ' . $db->quote((int) ($time - $session->getExpire()))); $db->setQuery($query); diff --git a/lib/libraries/cms/form/field/usergrouplist.php b/lib/libraries/cms/form/field/usergrouplist.php index 31a04964c3..dc8ca30762 100644 --- a/lib/libraries/cms/form/field/usergrouplist.php +++ b/lib/libraries/cms/form/field/usergrouplist.php @@ -59,8 +59,8 @@ protected function getOptions() ->select('a.id AS value') ->select('a.title AS text') ->select('COUNT(DISTINCT b.id) AS level') - ->from('#__usergroups as a') - ->join('LEFT', '#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt') + ->from('#__users_groups as a') + ->join('LEFT', '#__users_groups AS b ON a.lft > b.lft AND a.rgt < b.rgt') ->group('a.id, a.title, a.lft, a.rgt') ->order('a.lft ASC'); $db->setQuery($query); diff --git a/lib/libraries/cms/html/access.php b/lib/libraries/cms/html/access.php index 35dd84fc18..e0076280b9 100644 --- a/lib/libraries/cms/html/access.php +++ b/lib/libraries/cms/html/access.php @@ -45,7 +45,7 @@ public static function level($name, $selected, $attribs = '', $params = true, $i $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.id AS value, a.title AS text') - ->from('#__viewlevels AS a') + ->from('#__users_roles AS a') ->group('a.id, a.title, a.ordering') ->order('a.ordering ASC') ->order($db->quoteName('title') . ' ASC'); @@ -97,8 +97,8 @@ public static function usergroup($name, $selected, $attribs = '', $allowAll = tr $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level') - ->from($db->quoteName('#__usergroups') . ' AS a') - ->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') + ->from($db->quoteName('#__users_groups') . ' AS a') + ->join('LEFT', $db->quoteName('#__users_groups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') ->group('a.id, a.title, a.lft, a.rgt') ->order('a.lft ASC'); $db->setQuery($query); @@ -140,8 +140,8 @@ public static function usergroups($name, $selected, $checkSuperAdmin = false) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.*, COUNT(DISTINCT b.id) AS level') - ->from($db->quoteName('#__usergroups') . ' AS a') - ->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') + ->from($db->quoteName('#__users_groups') . ' AS a') + ->join('LEFT', $db->quoteName('#__users_groups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') ->group('a.id, a.title, a.lft, a.rgt, a.parent_id') ->order('a.lft ASC'); $db->setQuery($query); @@ -249,7 +249,7 @@ public static function assetgroups() $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.id AS value, a.title AS text') - ->from($db->quoteName('#__viewlevels') . ' AS a') + ->from($db->quoteName('#__users_roles') . ' AS a') ->group('a.id, a.title, a.ordering') ->order('a.ordering ASC'); diff --git a/lib/libraries/cms/html/list.php b/lib/libraries/cms/html/list.php index 92d9266878..21967e7a33 100644 --- a/lib/libraries/cms/html/list.php +++ b/lib/libraries/cms/html/list.php @@ -185,7 +185,7 @@ public static function users($name, $active, $nouser = 0, $javascript = null, $o $query = $db->getQuery(true) ->select('u.id AS value, u.name AS text') ->from('#__users AS u') - ->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = u.id') + ->join('LEFT', '#__users_groups_users AS m ON m.user_id = u.id') ->where('u.block = 0') ->order($order) ->group('u.id'); diff --git a/lib/libraries/cms/html/rules.php b/lib/libraries/cms/html/rules.php index c3957ffb06..434a740073 100644 --- a/lib/libraries/cms/html/rules.php +++ b/lib/libraries/cms/html/rules.php @@ -177,7 +177,7 @@ protected static function _getUserGroups() // Get the user groups from the database. $db->setQuery( 'SELECT a.id AS value, a.title AS text, b.id as parent' - . ' FROM #__usergroups AS a LEFT JOIN #__usergroups AS b ON a.lft >= b.lft AND a.rgt <= b.rgt' + . ' FROM #__users_groups AS a LEFT JOIN #__users_groups AS b ON a.lft >= b.lft AND a.rgt <= b.rgt' . ' ORDER BY a.lft ASC, b.lft ASC' ); $result = $db->loadObjectList(); diff --git a/lib/libraries/cms/html/user.php b/lib/libraries/cms/html/user.php index acba0b957b..5e40b6bdc9 100644 --- a/lib/libraries/cms/html/user.php +++ b/lib/libraries/cms/html/user.php @@ -32,8 +32,8 @@ public static function groups($includeSuperAdmin = false) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level') - ->from($db->quoteName('#__usergroups') . ' AS a') - ->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') + ->from($db->quoteName('#__users_groups') . ' AS a') + ->join('LEFT', $db->quoteName('#__users_groups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') ->group('a.id, a.title, a.lft, a.rgt') ->order('a.lft ASC'); $db->setQuery($query); diff --git a/lib/libraries/joomla/access/access.php b/lib/libraries/joomla/access/access.php index 86710631a6..ccd6663fe8 100644 --- a/lib/libraries/joomla/access/access.php +++ b/lib/libraries/joomla/access/access.php @@ -172,7 +172,7 @@ protected static function getGroupPath($groupId) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('parent.id, parent.lft, parent.rgt') - ->from('#__usergroups AS parent') + ->from('#__users_groups AS parent') ->order('parent.lft'); $db->setQuery($query); self::$userGroups = $db->loadObjectList('id'); @@ -313,20 +313,20 @@ public static function getGroupsByUser($userId, $recursive = true) if (empty($userId)) { - $query->from('#__usergroups AS a') + $query->from('#__users_groups AS a') ->where('a.id = ' . (int) $guestUsergroup); } else { - $query->from('#__user_usergroup_map AS map') + $query->from('#__users_groups_users AS map') ->where('map.user_id = ' . (int) $userId) - ->join('LEFT', '#__usergroups AS a ON a.id = map.group_id'); + ->join('LEFT', '#__users_groups AS a ON a.id = map.group_id'); } // If we want the rules cascading up to the global asset node we need a self-join. if ($recursive) { - $query->join('LEFT', '#__usergroups AS b ON b.lft <= a.lft AND b.rgt >= a.rgt'); + $query->join('LEFT', '#__users_groups AS b ON b.lft <= a.lft AND b.rgt >= a.rgt'); } // Execute the query and load the rules from the result. @@ -373,9 +373,9 @@ public static function getUsersByGroup($groupId, $recursive = false) // First find the users contained in the group $query = $db->getQuery(true) ->select('DISTINCT(user_id)') - ->from('#__usergroups as ug1') - ->join('INNER', '#__usergroups AS ug2 ON ug2.lft' . $test . 'ug1.lft AND ug1.rgt' . $test . 'ug2.rgt') - ->join('INNER', '#__user_usergroup_map AS m ON ug2.id=m.group_id') + ->from('#__users_groups as ug1') + ->join('INNER', '#__users_groups AS ug2 ON ug2.lft' . $test . 'ug1.lft AND ug1.rgt' . $test . 'ug2.rgt') + ->join('INNER', '#__users_groups_users AS m ON ug2.id=m.group_id') ->where('ug1.id=' . $db->quote($groupId)); $db->setQuery($query); @@ -411,7 +411,7 @@ public static function getAuthorisedViewLevels($userId) // Build the base query. $query = $db->getQuery(true) ->select('id, rules') - ->from($db->quoteName('#__viewlevels')); + ->from($db->quoteName('#__users_roles')); // Set the query for execution. $db->setQuery($query); diff --git a/lib/libraries/joomla/form/fields/rules.php b/lib/libraries/joomla/form/fields/rules.php index 96de1bddfd..cc928a205f 100644 --- a/lib/libraries/joomla/form/fields/rules.php +++ b/lib/libraries/joomla/form/fields/rules.php @@ -395,8 +395,8 @@ protected function getUserGroups() $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level, a.parent_id') - ->from('#__usergroups AS a') - ->join('LEFT', $db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') + ->from('#__users_groups AS a') + ->join('LEFT', $db->quoteName('#__users_groups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') ->group('a.id, a.title, a.lft, a.rgt, a.parent_id') ->order('a.lft ASC'); $db->setQuery($query); diff --git a/lib/libraries/joomla/session/storage/database.php b/lib/libraries/joomla/session/storage/database.php index 073a5d49bc..079e7ada3c 100644 --- a/lib/libraries/joomla/session/storage/database.php +++ b/lib/libraries/joomla/session/storage/database.php @@ -38,7 +38,7 @@ public function read($id) // Get the session data from the database table. $query = $db->getQuery(true) ->select($db->quoteName('data')) - ->from($db->quoteName('#__session')) + ->from($db->quoteName('#__users_sessions')) ->where($db->quoteName('session_id') . ' = ' . $db->quote($id)); $db->setQuery($query); @@ -75,7 +75,7 @@ public function write($id, $data) try { $query = $db->getQuery(true) - ->update($db->quoteName('#__session')) + ->update($db->quoteName('#__users_sessions')) ->set($db->quoteName('data') . ' = ' . $db->quote($data)) ->set($db->quoteName('time') . ' = ' . $db->quote((int) time())) ->where($db->quoteName('session_id') . ' = ' . $db->quote($id)); @@ -115,7 +115,7 @@ public function destroy($id) try { $query = $db->getQuery(true) - ->delete($db->quoteName('#__session')) + ->delete($db->quoteName('#__users_sessions')) ->where($db->quoteName('session_id') . ' = ' . $db->quote($id)); // Remove a session from the database. @@ -149,7 +149,7 @@ public function gc($lifetime = 1440) try { $query = $db->getQuery(true) - ->delete($db->quoteName('#__session')) + ->delete($db->quoteName('#__users_sessions')) ->where($db->quoteName('time') . ' < ' . $db->quote((int) $past)); // Remove expired sessions from the database. diff --git a/lib/libraries/joomla/table/table.php b/lib/libraries/joomla/table/table.php index 48df5f8cab..bf1cf6b02d 100644 --- a/lib/libraries/joomla/table/table.php +++ b/lib/libraries/joomla/table/table.php @@ -1270,7 +1270,7 @@ public function isCheckedOut($with = 0, $against = null) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('COUNT(userid)') - ->from($db->quoteName('#__session')) + ->from($db->quoteName('#__users_sessions')) ->where($db->quoteName('userid') . ' = ' . (int) $against); $db->setQuery($query); $checkedOut = (boolean) $db->loadResult(); diff --git a/lib/libraries/joomla/table/user.php b/lib/libraries/joomla/table/user.php index ac2be83021..553bbf7c3d 100644 --- a/lib/libraries/joomla/table/user.php +++ b/lib/libraries/joomla/table/user.php @@ -100,8 +100,8 @@ public function load($userId = null, $reset = true) $query->clear() ->select($this->_db->quoteName('g.id')) ->select($this->_db->quoteName('g.title')) - ->from($this->_db->quoteName('#__usergroups') . ' AS g') - ->join('INNER', $this->_db->quoteName('#__user_usergroup_map') . ' AS m ON m.group_id = g.id') + ->from($this->_db->quoteName('#__users_groups') . ' AS g') + ->join('INNER', $this->_db->quoteName('#__users_groups_users') . ' AS m ON m.group_id = g.id') ->where($this->_db->quoteName('m.user_id') . ' = ' . (int) $userId); $this->_db->setQuery($query); @@ -144,7 +144,7 @@ public function bind($array, $ignore = '') $query = $this->_db->getQuery(true) ->select($this->_db->quoteName('id')) ->select($this->_db->quoteName('title')) - ->from($this->_db->quoteName('#__usergroups')) + ->from($this->_db->quoteName('#__users_groups')) ->where($this->_db->quoteName('id') . ' = ' . implode(' OR ' . $this->_db->quoteName('id') . ' = ', $this->groups)); $this->_db->setQuery($query); @@ -299,14 +299,14 @@ public function store($updateNulls = false) if (is_array($this->groups) && count($this->groups)) { // Delete the old user group maps. - $query->delete($this->_db->quoteName('#__user_usergroup_map')) + $query->delete($this->_db->quoteName('#__users_groups_users')) ->where($this->_db->quoteName('user_id') . ' = ' . (int) $this->id); $this->_db->setQuery($query); $this->_db->execute(); // Set the new user group maps. $query->clear() - ->insert($this->_db->quoteName('#__user_usergroup_map')) + ->insert($this->_db->quoteName('#__users_groups_users')) ->columns(array($this->_db->quoteName('user_id'), $this->_db->quoteName('group_id'))); // Have to break this up into individual queries for cross-database support. @@ -323,7 +323,7 @@ public function store($updateNulls = false) if ($this->block == (int) 1) { $query->clear() - ->delete($this->_db->quoteName('#__user_keys')) + ->delete($this->_db->quoteName('#__users_keys')) ->where($this->_db->quoteName('user_id') . ' = ' . $this->_db->quote($this->username)); $this->_db->setQuery($query); $this->_db->execute(); @@ -360,7 +360,7 @@ public function delete($userId = null) // Delete the user group maps. $query->clear() - ->delete($this->_db->quoteName('#__user_usergroup_map')) + ->delete($this->_db->quoteName('#__users_groups_users')) ->where($this->_db->quoteName('user_id') . ' = ' . (int) $this->$k); $this->_db->setQuery($query); $this->_db->execute(); @@ -370,7 +370,7 @@ public function delete($userId = null) */ $query->clear() - ->delete($this->_db->quoteName('#__user_keys')) + ->delete($this->_db->quoteName('#__users_keys')) ->where($this->_db->quoteName('user_id') . ' = ' . $this->_db->quote($this->username)); $this->_db->setQuery($query); $this->_db->execute(); diff --git a/lib/libraries/joomla/table/usergroup.php b/lib/libraries/joomla/table/usergroup.php index d98813eafe..7507010d85 100644 --- a/lib/libraries/joomla/table/usergroup.php +++ b/lib/libraries/joomla/table/usergroup.php @@ -27,7 +27,7 @@ class JTableUsergroup extends JTable */ public function __construct($db) { - parent::__construct('#__usergroups', 'id', $db); + parent::__construct('#__users_groups', 'id', $db); } /** @@ -209,7 +209,7 @@ public function delete($oid = null) $query->clear() ->select('id, rules') - ->from('#__viewlevels'); + ->from('#__users_roles'); $db->setQuery($query); $rules = $db->loadObjectList(); @@ -230,7 +230,7 @@ public function delete($oid = null) { $query->clear() ->set('rules=' . str_repeat('replace(', 4 * count($ids)) . 'rules' . implode('', $replace)) - ->update('#__viewlevels') + ->update('#__users_roles') ->where('id IN (' . implode(',', $match_ids) . ')'); $db->setQuery($query); $db->execute(); @@ -238,7 +238,7 @@ public function delete($oid = null) // Delete the user to usergroup mappings for the group(s) from the database. $query->clear() - ->delete($db->quoteName('#__user_usergroup_map')) + ->delete($db->quoteName('#__users_groups_users')) ->where($db->quoteName('group_id') . ' IN (' . implode(',', $ids) . ')'); $db->setQuery($query); $db->execute(); diff --git a/lib/libraries/joomla/table/viewlevel.php b/lib/libraries/joomla/table/viewlevel.php index 4751ff67b8..fd92df2c12 100644 --- a/lib/libraries/joomla/table/viewlevel.php +++ b/lib/libraries/joomla/table/viewlevel.php @@ -27,7 +27,7 @@ class JTableViewlevel extends JTable */ public function __construct($db) { - parent::__construct('#__viewlevels', 'id', $db); + parent::__construct('#__users_roles', 'id', $db); } /** diff --git a/lib/libraries/joomla/user/helper.php b/lib/libraries/joomla/user/helper.php index 4b3a1b0bd5..7a4c02d242 100644 --- a/lib/libraries/joomla/user/helper.php +++ b/lib/libraries/joomla/user/helper.php @@ -44,7 +44,7 @@ public static function addUserToGroup($userId, $groupId) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('title')) - ->from($db->quoteName('#__usergroups')) + ->from($db->quoteName('#__users_groups')) ->where($db->quoteName('id') . ' = ' . (int) $groupId); $db->setQuery($query); $title = $db->loadResult(); @@ -162,7 +162,7 @@ public static function setUserGroups($userId, $groups) $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id') . ', ' . $db->quoteName('title')) - ->from($db->quoteName('#__usergroups')) + ->from($db->quoteName('#__users_groups')) ->where($db->quoteName('id') . ' = ' . implode(' OR ' . $db->quoteName('id') . ' = ', $user->groups)); $db->setQuery($query); $results = $db->loadObjectList(); @@ -726,7 +726,7 @@ public static function invalidateCookie($userId, $cookieName) // Invalidate cookie in the database $query - ->update($db->quoteName('#__user_keys')) + ->update($db->quoteName('#__users_keys')) ->set($db->quoteName('invalid') . ' = 1') ->where($db->quotename('user_id') . ' = ' . $db->quote($userId)); @@ -753,7 +753,7 @@ public static function clearExpiredTokens() $db = JFactory::getDbo(); $query = $db->getQuery(true) - ->delete('#__user_keys') + ->delete('#__users_keys') ->where($db->quoteName('time') . ' < ' . $db->quote($now)); return $db->setQuery($query)->execute(); diff --git a/lib/libraries/legacy/application/application.php b/lib/libraries/legacy/application/application.php index 2fcfef94e4..38409273c3 100644 --- a/lib/libraries/legacy/application/application.php +++ b/lib/libraries/legacy/application/application.php @@ -951,7 +951,7 @@ protected function _createConfiguration($file) * Old sessions are flushed based on the configuration value for the cookie * lifetime. If an existing session, then the last access time is updated. * If a new session, a session id is generated and a record is created in - * the #__sessions table. + * the #__users_sessions table. * * @param string $name The sessions name. * @@ -1000,7 +1000,7 @@ protected function _createSession($name) // The modulus introduces a little entropy, making the flushing less accurate // but fires the query less than half the time. $query = $db->getQuery(true) - ->delete($db->quoteName('#__session')) + ->delete($db->quoteName('#__users_sessions')) ->where($db->quoteName('time') . ' < ' . $db->quote((int) ($time - $session->getExpire()))); $db->setQuery($query); @@ -1038,7 +1038,7 @@ public function checkSession() $query = $db->getQuery(true) ->select($db->quoteName('session_id')) - ->from($db->quoteName('#__session')) + ->from($db->quoteName('#__users_sessions')) ->where($db->quoteName('session_id') . ' = ' . $db->quote($session->getId())); $db->setQuery($query, 0, 1); @@ -1051,14 +1051,14 @@ public function checkSession() if ($session->isNew()) { - $query->insert($db->quoteName('#__session')) + $query->insert($db->quoteName('#__users_sessions')) ->columns($db->quoteName('session_id') . ', ' . $db->quoteName('client_id') . ', ' . $db->quoteName('time')) ->values($db->quote($session->getId()) . ', ' . (int) $this->getClientId() . ', ' . $db->quote((int) time())); $db->setQuery($query); } else { - $query->insert($db->quoteName('#__session')) + $query->insert($db->quoteName('#__users_sessions')) ->columns( $db->quoteName('session_id') . ', ' . $db->quoteName('client_id') . ', ' . $db->quoteName('guest') . ', ' . $db->quoteName('time') . ', ' . $db->quoteName('userid') . ', ' . $db->quoteName('username') diff --git a/lib/libraries/legacy/table/session.php b/lib/libraries/legacy/table/session.php index fa466ce3d7..450dcb0e91 100644 --- a/lib/libraries/legacy/table/session.php +++ b/lib/libraries/legacy/table/session.php @@ -30,7 +30,7 @@ class JTableSession extends JTable public function __construct(JDatabaseDriver $db) { JLog::add('JTableSession is deprecated. Use SQL queries directly to interact with the session table.', JLog::WARNING, 'deprecated'); - parent::__construct('#__session', 'session_id', $db); + parent::__construct('#__users_sessions', 'session_id', $db); $this->guest = 1; $this->username = ''; diff --git a/lib/plugins/authentication/cookie/cookie.php b/lib/plugins/authentication/cookie/cookie.php index 058d7ca3bf..1b095eb69d 100644 --- a/lib/plugins/authentication/cookie/cookie.php +++ b/lib/plugins/authentication/cookie/cookie.php @@ -84,14 +84,14 @@ public function onUserAuthenticate($credentials, $options, &$response) // Remove expired tokens $query = $this->db->getQuery(true) - ->delete('#__user_keys') + ->delete('#__users_keys') ->where($this->db->quoteName('time') . ' < ' . $this->db->quote(time())); $this->db->setQuery($query)->execute(); // Find the matching record if it exists. $query = $this->db->getQuery(true) ->select($this->db->quoteName(array('user_id', 'token', 'series', 'time'))) - ->from($this->db->quoteName('#__user_keys')) + ->from($this->db->quoteName('#__users_keys')) ->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series)) ->where($this->db->quoteName('uastring') . ' = ' . $this->db->quote($cookieName)) ->order($this->db->quoteName('time') . ' DESC'); @@ -116,7 +116,7 @@ public function onUserAuthenticate($credentials, $options, &$response) // This is a real attack! Either the series was guessed correctly or a cookie was stolen and used twice (once by attacker and once by victim). // Delete all tokens for this user! $query = $this->db->getQuery(true) - ->delete('#__user_keys') + ->delete('#__users_keys') ->where($this->db->quoteName('user_id') . ' = ' . $this->db->quote($results[0]->user_id)); $this->db->setQuery($query)->execute(); @@ -207,7 +207,7 @@ public function onUserAfterLogin($options) $series = JUserHelper::genRandomPassword(20); $query = $this->db->getQuery(true) ->select($this->db->quoteName('series')) - ->from($this->db->quoteName('#__user_keys')) + ->from($this->db->quoteName('#__users_keys')) ->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series)); $results = $this->db->setQuery($query)->loadResult(); @@ -242,7 +242,7 @@ public function onUserAfterLogin($options) { // Create new record $query - ->insert($this->db->quoteName('#__user_keys')) + ->insert($this->db->quoteName('#__users_keys')) ->set($this->db->quoteName('user_id') . ' = ' . $this->db->quote($options['user']->username)) ->set($this->db->quoteName('series') . ' = ' . $this->db->quote($series)) ->set($this->db->quoteName('uastring') . ' = ' . $this->db->quote($cookieName)) @@ -252,7 +252,7 @@ public function onUserAfterLogin($options) { // Update existing record with new token $query - ->update($this->db->quoteName('#__user_keys')) + ->update($this->db->quoteName('#__users_keys')) ->where($this->db->quoteName('user_id') . ' = ' . $this->db->quote($options['user']->username)) ->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series)) ->where($this->db->quoteName('uastring') . ' = ' . $this->db->quote($cookieName)); @@ -301,7 +301,7 @@ public function onUserAfterLogout($options) // Remove the record from the database $query = $this->db->getQuery(true); $query - ->delete('#__user_keys') + ->delete('#__users_keys') ->where($this->db->quoteName('series') . ' = ' . $this->db->quote($series)); $this->db->setQuery($query)->execute(); diff --git a/lib/plugins/user/joomla/joomla.php b/lib/plugins/user/joomla/joomla.php index d6dd7c9e53..c514eae486 100644 --- a/lib/plugins/user/joomla/joomla.php +++ b/lib/plugins/user/joomla/joomla.php @@ -55,7 +55,7 @@ public function onUserAfterDelete($user, $success, $msg) } $query = $this->db->getQuery(true) - ->delete($this->db->quoteName('#__session')) + ->delete($this->db->quoteName('#__users_sessions')) ->where($this->db->quoteName('userid') . ' = ' . (int) $user['id']); $this->db->setQuery($query)->execute(); @@ -210,7 +210,7 @@ public function onUserLogin($user, $options = array()) // Update the user related fields for the Joomla sessions table. $query = $this->db->getQuery(true) - ->update($this->db->quoteName('#__session')) + ->update($this->db->quoteName('#__users_sessions')) ->set($this->db->quoteName('guest') . ' = ' . $this->db->quote($instance->guest)) ->set($this->db->quoteName('username') . ' = ' . $this->db->quote($instance->username)) ->set($this->db->quoteName('userid') . ' = ' . (int) $instance->id) @@ -260,7 +260,7 @@ public function onUserLogout($user, $options = array()) if ($forceLogout) { $query = $this->db->getQuery(true) - ->delete($this->db->quoteName('#__session')) + ->delete($this->db->quoteName('#__users_sessions')) ->where($this->db->quoteName('userid') . ' = ' . (int) $user['id']) ->where($this->db->quoteName('client_id') . ' = ' . (int) $options['clientid']); $this->db->setQuery($query)->execute(); diff --git a/lib/plugins/user/profile/profile.php b/lib/plugins/user/profile/profile.php index a3489407dd..f216c553ec 100644 --- a/lib/plugins/user/profile/profile.php +++ b/lib/plugins/user/profile/profile.php @@ -75,7 +75,7 @@ public function onContentPrepareData($context, $data) // Load the profile data from the database. $db = JFactory::getDbo(); $db->setQuery( - 'SELECT profile_key, profile_value FROM #__user_profiles' . + 'SELECT profile_key, profile_value FROM #__users_profiles' . ' WHERE user_id = ' . (int) $userId . " AND profile_key LIKE 'profile.%'" . ' ORDER BY ordering' ); @@ -381,7 +381,7 @@ public function onUserAfterSave($data, $isNew, $result, $error) $db = JFactory::getDbo(); $query = $db->getQuery(true) - ->delete($db->quoteName('#__user_profiles')) + ->delete($db->quoteName('#__users_profiles')) ->where($db->quoteName('user_id') . ' = ' . (int) $userId) ->where($db->quoteName('profile_key') . ' LIKE ' . $db->quote('profile.%')); $db->setQuery($query); @@ -395,7 +395,7 @@ public function onUserAfterSave($data, $isNew, $result, $error) $tuples[] = '(' . $userId . ', ' . $db->quote('profile.' . $k) . ', ' . $db->quote(json_encode($v)) . ', ' . ($order++) . ')'; } - $db->setQuery('INSERT INTO #__user_profiles VALUES ' . implode(', ', $tuples)); + $db->setQuery('INSERT INTO #__users_profiles VALUES ' . implode(', ', $tuples)); $db->execute(); } catch (RuntimeException $e) @@ -435,7 +435,7 @@ public function onUserAfterDelete($user, $success, $msg) { $db = JFactory::getDbo(); $db->setQuery( - 'DELETE FROM #__user_profiles WHERE user_id = ' . $userId . + 'DELETE FROM #__users_profiles WHERE user_id = ' . $userId . " AND profile_key LIKE 'profile.%'" );