From 38690161f843f8d6703a6b0dc3c893d6e949bc8e Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Tue, 4 Nov 2014 18:59:58 +0100 Subject: [PATCH] =?UTF-8?q?Reverting=20#3972=20and=20implementing=20clearA?= =?UTF-8?q?ccessR=C3=ADghts=20to=20get=20a=20similar=20effect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sql/updates/mysql/3.4.0-2014-07-26.sql | 3 - .../updates/postgresql/3.4.0-2014-07-26.sql | 3 - .../sql/updates/sqlazure/3.4.0-2014-07-26.sql | 8 - .../language/en-GB/en-GB.lib_joomla.ini | 3 - .../en-GB/en-GB.plg_system_session.ini | 11 - .../en-GB/en-GB.plg_system_session.sys.ini | 7 - .../language/en-GB/en-GB.plg_user_session.ini | 14 -- .../en-GB/en-GB.plg_user_session.sys.ini | 7 - installation/sql/mysql/joomla.sql | 2 - installation/sql/postgresql/joomla.sql | 4 +- installation/sql/sqlazure/joomla.sql | 6 +- language/en-GB/en-GB.lib_joomla.ini | 3 - libraries/joomla/session/helper.php | 116 ----------- libraries/joomla/user/user.php | 33 ++- plugins/system/session/index.html | 1 - plugins/system/session/session.php | 134 ------------ plugins/system/session/session.xml | 20 -- plugins/user/session/index.html | 1 - plugins/user/session/session.php | 193 ------------------ plugins/user/session/session.xml | 34 --- 20 files changed, 25 insertions(+), 578 deletions(-) delete mode 100644 administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-07-26.sql delete mode 100644 administrator/components/com_admin/sql/updates/postgresql/3.4.0-2014-07-26.sql delete mode 100644 administrator/components/com_admin/sql/updates/sqlazure/3.4.0-2014-07-26.sql delete mode 100644 administrator/language/en-GB/en-GB.plg_system_session.ini delete mode 100644 administrator/language/en-GB/en-GB.plg_system_session.sys.ini delete mode 100644 administrator/language/en-GB/en-GB.plg_user_session.ini delete mode 100644 administrator/language/en-GB/en-GB.plg_user_session.sys.ini delete mode 100644 libraries/joomla/session/helper.php delete mode 100644 plugins/system/session/index.html delete mode 100644 plugins/system/session/session.php delete mode 100644 plugins/system/session/session.xml delete mode 100644 plugins/user/session/index.html delete mode 100644 plugins/user/session/session.php delete mode 100644 plugins/user/session/session.xml diff --git a/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-07-26.sql b/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-07-26.sql deleted file mode 100644 index 893ccd9600814..0000000000000 --- a/administrator/components/com_admin/sql/updates/mysql/3.4.0-2014-07-26.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES -(452, 'plg_system_session', 'plugin', 'session', 'system', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(453, 'plg_user_session', 'plugin', 'session', 'user', 0, 1, 1, 1, '', '{"session_update_flag_name":"refresh"}', '', '', 0, '0000-00-00 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.4.0-2014-07-26.sql b/administrator/components/com_admin/sql/updates/postgresql/3.4.0-2014-07-26.sql deleted file mode 100644 index 349e166922222..0000000000000 --- a/administrator/components/com_admin/sql/updates/postgresql/3.4.0-2014-07-26.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES -(452, 'plg_system_session', 'plugin', 'session', 'system', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(453, 'plg_user_session', 'plugin', 'session', 'user', 0, 1, 1, 1, '', '{"session_update_flag_name":"refresh"}', '', 0, '1970-01-01 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.4.0-2014-07-26.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.4.0-2014-07-26.sql deleted file mode 100644 index f49d132ba6667..0000000000000 --- a/administrator/components/com_admin/sql/updates/sqlazure/3.4.0-2014-07-26.sql +++ /dev/null @@ -1,8 +0,0 @@ -SET IDENTITY_INSERT [#__extensions] ON; - -INSERT [#__extensions] ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state]) -SELECT 452, 'plg_system_session', 'plugin', 'session', 'system', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 -UNION ALL -SELECT 453, 'plg_user_session', 'plugin', 'session', 'user', 0, 1, 1, 1, '', '{"session_update_flag_name":"refresh"}', '', '', 0, '1900-01-01 00:00:00', 0, 0; - -SET IDENTITY_INSERT [#__extensions] OFF; diff --git a/administrator/language/en-GB/en-GB.lib_joomla.ini b/administrator/language/en-GB/en-GB.lib_joomla.ini index bc6b09f06f466..5fd98bee4f6c8 100644 --- a/administrator/language/en-GB/en-GB.lib_joomla.ini +++ b/administrator/language/en-GB/en-GB.lib_joomla.ini @@ -626,9 +626,6 @@ JLIB_RULES_SETTING_NOTES="1. If you change the setting, it will apply to this an JLIB_RULES_SETTING_NOTES_ITEM="1. If you change the setting, it will apply to this item. Note that:
Inherited means that the permissions from global configuration, parent group and category will be used.
Denied means that no matter what the global configuration, parent group or category settings are, the group being edited cannot take this action on this item.
Allowed means that the group being edited will be able to take this action for this item (but if this is in conflict with the global configuration, parent group or category it will have no impact; a conflict will be indicated by Not Allowed (Locked) under Calculated Settings).
2. If you select a new setting, click Save to refresh the calculated settings." JLIB_RULES_SETTINGS_DESC="Manage the permission settings for the user groups below. See notes at the bottom." -JLIB_SESSION_ERROR_INVALID_REMAINING_DATA="Unsupported session.serialize_handler: %s. Supported: php, php_binary" -JLIB_SESSION_ERROR_UNSUPPORTED_HANDLER="Invalid data, remaining: %s" - JLIB_UNKNOWN="Unknown" JLIB_UPDATER_ERROR_COLLECTION_FOPEN="The PHP allow_url_fopen setting is disabled. This setting must be enabled for the updater to work." JLIB_UPDATER_ERROR_COLLECTION_OPEN_URL="Update: :Collection: Could not open %s" diff --git a/administrator/language/en-GB/en-GB.plg_system_session.ini b/administrator/language/en-GB/en-GB.plg_system_session.ini deleted file mode 100644 index 516499db57320..0000000000000 --- a/administrator/language/en-GB/en-GB.plg_system_session.ini +++ /dev/null @@ -1,11 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_SYSTEM_SESSION="System - Session" -PLG_SYSTEM_SESSION_ERROR_STORE_FAIL="Failed to store session data." -PLG_SYSTEM_SESSION_ERROR_STORE_FAIL_DEBUG="Setting the session update flag failed with session handler: %s" -PLG_SYSTEM_SESSION_ERROR_STORE_SUCCESS_DEBUG="Setting the session update flag succeeded with session handler: %s" -PLG_SYSTEM_SESSION_ERROR_UNSUPPORTED_HANDLER="%s doesn't (yet) support the immediate session update.
With this session handler, your users are required to log out and back in again for the changes to effect!" -PLG_SYSTEM_SESSION_XML_DESCRIPTION="With this plugin changes to a user's rights are immediately applied. No re-login required." diff --git a/administrator/language/en-GB/en-GB.plg_system_session.sys.ini b/administrator/language/en-GB/en-GB.plg_system_session.sys.ini deleted file mode 100644 index f9aee1c5f5fba..0000000000000 --- a/administrator/language/en-GB/en-GB.plg_system_session.sys.ini +++ /dev/null @@ -1,7 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_SYSTEM_SESSION="System - Session" -PLG_SYSTEM_SESSION_XML_DESCRIPTION="With this plugin changes to a user's rights are immediately applied - no re-login" diff --git a/administrator/language/en-GB/en-GB.plg_user_session.ini b/administrator/language/en-GB/en-GB.plg_user_session.ini deleted file mode 100644 index f649f1d857098..0000000000000 --- a/administrator/language/en-GB/en-GB.plg_user_session.ini +++ /dev/null @@ -1,14 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_USER_SESSION="User - Session" -PLG_USER_SESSION_ERROR_STORE_FAIL="Failed to store session data." -PLG_USER_SESSION_ERROR_STORE_FAIL_DEBUG="Setting the session update flag failed with session handler: %s" -PLG_USER_SESSION_ERROR_STORE_SUCCESS_DEBUG="Setting the session update flag succeeded with session handler: %s" -PLG_USER_SESSION_ERROR_UNSUPPORTED_HANDLER="%s doesn't (yet) support the immediate session update.
With this session handler, your users are required to log out and back in again for the changes to effect!" -PLG_USER_SESSION_HINT_ENABLE_BOTH_PLUGINS="Please enable both the system-session plugin and user-session plugin for the session handling to properly work." -PLG_USER_SESSION_UPDATE_FLAG_NAME_DESC="Define the variable name to use as the session update flag. Default value is 'refresh'" -PLG_USER_SESSION_UPDATE_FLAG_NAME_LABEL="Update Flag Name:" -PLG_USER_SESSION_XML_DESCRIPTION="With this plugin changes to a user's rights are immediately applied. No re-login required." diff --git a/administrator/language/en-GB/en-GB.plg_user_session.sys.ini b/administrator/language/en-GB/en-GB.plg_user_session.sys.ini deleted file mode 100644 index a3b0867caca37..0000000000000 --- a/administrator/language/en-GB/en-GB.plg_user_session.sys.ini +++ /dev/null @@ -1,7 +0,0 @@ -; Joomla! Project -; Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. -; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php -; Note : All ini files need to be saved as UTF-8 - -PLG_USER_SESSION="User - Session" -PLG_USER_SESSION_XML_DESCRIPTION="With this plugin changes to a user's rights are immediately applied - no re-login" diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index 07400ecd3ea30..3bdf389d828b4 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -610,8 +610,6 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (449, 'plg_authentication_cookie', 'plugin', 'cookie', 'authentication', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (450, 'plg_twofactorauth_yubikey', 'plugin', 'yubikey', 'twofactorauth', 0, 0, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(452, 'plg_system_session', 'plugin', 'session', 'system', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), -(453, 'plg_user_session', 'plugin', 'session', 'user', 0, 1, 1, 1, '', '{"session_update_flag_name":"refresh"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index 0d9099596f3db..241f677850d44 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -609,9 +609,7 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (448, 'plg_twofactorauth_totp', 'plugin', 'totp', 'twofactorauth', 0, 0, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (449, 'plg_authentication_cookie', 'plugin', 'cookie', 'authentication', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (450, 'plg_twofactorauth_yubikey', 'plugin', 'yubikey', 'twofactorauth', 0, 0, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(452, 'plg_system_session', 'plugin', 'session', 'system', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(453, 'plg_user_session', 'plugin', 'session', 'user', 0, 1, 1, 1, '', '{"session_update_flag_name":"refresh"}', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0); -- Templates INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES diff --git a/installation/sql/sqlazure/joomla.sql b/installation/sql/sqlazure/joomla.sql index 2ac73a673c494..28364baf9babb 100644 --- a/installation/sql/sqlazure/joomla.sql +++ b/installation/sql/sqlazure/joomla.sql @@ -1011,11 +1011,7 @@ SELECT 449, 'plg_authentication_cookie', 'plugin', 'cookie', 'authentication', 0 UNION ALL SELECT 450, 'plg_twofactorauth_yubikey', 'plugin', 'yubikey', 'twofactorauth', 0, 0, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 UNION ALL -SELECT 451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '1900-01-01 00:00:00', 0, 0 -UNION ALL -SELECT 452, 'plg_system_session', 'plugin', 'session', 'system', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0 -UNION ALL -SELECT 453, 'plg_user_session', 'plugin', 'session', 'user', 0, 1, 1, 1, '', '{"session_update_flag_name":"refresh"}', '', '', 0, '1900-01-01 00:00:00', 0, 0; +SELECT 451, 'plg_search_tags', 'plugin', 'tags', 'search', 0, 1, 1, 0, '', '{"search_limit":"50","show_tagged_items":"1"}', '', '', 0, '1900-01-01 00:00:00', 0, 0; INSERT [#__extensions] ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state]) diff --git a/language/en-GB/en-GB.lib_joomla.ini b/language/en-GB/en-GB.lib_joomla.ini index bc6b09f06f466..5fd98bee4f6c8 100644 --- a/language/en-GB/en-GB.lib_joomla.ini +++ b/language/en-GB/en-GB.lib_joomla.ini @@ -626,9 +626,6 @@ JLIB_RULES_SETTING_NOTES="1. If you change the setting, it will apply to this an JLIB_RULES_SETTING_NOTES_ITEM="1. If you change the setting, it will apply to this item. Note that:
Inherited means that the permissions from global configuration, parent group and category will be used.
Denied means that no matter what the global configuration, parent group or category settings are, the group being edited cannot take this action on this item.
Allowed means that the group being edited will be able to take this action for this item (but if this is in conflict with the global configuration, parent group or category it will have no impact; a conflict will be indicated by Not Allowed (Locked) under Calculated Settings).
2. If you select a new setting, click Save to refresh the calculated settings." JLIB_RULES_SETTINGS_DESC="Manage the permission settings for the user groups below. See notes at the bottom." -JLIB_SESSION_ERROR_INVALID_REMAINING_DATA="Unsupported session.serialize_handler: %s. Supported: php, php_binary" -JLIB_SESSION_ERROR_UNSUPPORTED_HANDLER="Invalid data, remaining: %s" - JLIB_UNKNOWN="Unknown" JLIB_UPDATER_ERROR_COLLECTION_FOPEN="The PHP allow_url_fopen setting is disabled. This setting must be enabled for the updater to work." JLIB_UPDATER_ERROR_COLLECTION_OPEN_URL="Update: :Collection: Could not open %s" diff --git a/libraries/joomla/session/helper.php b/libraries/joomla/session/helper.php deleted file mode 100644 index 9ef21fb7fa3fe..0000000000000 --- a/libraries/joomla/session/helper.php +++ /dev/null @@ -1,116 +0,0 @@ - - * @link http://www.php.net/manual/en/function.session-decode.php#108037 - * @since 3.4 - */ -class JSessionHelper -{ - /** - * Method to detect and call the available {@link http://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler} - * session.serialize_handler - * - * @param string $session_data The session data to process - * - * @return mixed - * - * @since 3.4 - * @throws RuntimeException - */ - public function unserialize($session_data) - { - $handler = strtolower(ini_get('session.serialize_handler')); - - switch ($handler) - { - case 'php' : - return $this->unserialize_php($session_data); - - case 'php_binary' : - return $this->unserialize_phpbinary($session_data); - - default : - throw new RuntimeException(JText::sprintf('JLIB_SESSION_ERROR_UNSUPPORTED_HANDLER', $handler)); - } - } - - /** - * Unserializes the session data for the PHP session serialize handler - * - * @param string $session_data The session data to process - * - * @return array - * - * @since 3.4 - * @throws RuntimeException - */ - private function unserialize_php($session_data) - { - $return_data = array(); - $offset = 0; - - while ($offset < strlen($session_data)) - { - if (!strstr(substr($session_data, $offset), '|')) - { - throw new RuntimeException(JText::sprintf('JLIB_SESSION_ERROR_INVALID_REMAINING_DATA', substr($session_data, $offset))); - } - - $pos = strpos($session_data, '|', $offset); - $length = $pos - $offset; - $varname = substr($session_data, $offset, $length); - $offset += $length + 1; - $data = unserialize(substr($session_data, $offset)); - - $return_data[$varname] = $data; - - $offset += strlen(serialize($data)); - } - - return $return_data; - } - - /** - * Unserializes the session data for the PHP binary session serialize handler - * - * @param string $session_data The session data to process - * - * @return array - * - * @since 3.4 - */ - private function unserialize_phpbinary($session_data) - { - $return_data = array(); - $offset = 0; - - while ($offset < strlen($session_data)) - { - $length = ord($session_data[$offset]); - $offset++; - $varname = substr($session_data, $offset, $length); - $offset += $length; - $data = unserialize(substr($session_data, $offset)); - - $return_data[$varname] = $data; - - $offset += strlen(serialize($data)); - } - - return $return_data; - } -} diff --git a/libraries/joomla/user/user.php b/libraries/joomla/user/user.php index 560f47c7e9c28..39ace07fc3eff 100644 --- a/libraries/joomla/user/user.php +++ b/libraries/joomla/user/user.php @@ -448,11 +448,10 @@ public function getAuthorisedViewLevels() $this->_authLevels = array(); } - /* - * Force loading the latest state. - * Otherwise updating the user session fails because it sticks with the 'old' values. - */ - $this->_authLevels = JAccess::getAuthorisedViewLevels($this->id); + if (empty($this->_authLevels)) + { + $this->_authLevels = JAccess::getAuthorisedViewLevels($this->id); + } return $this->_authLevels; } @@ -471,15 +470,29 @@ public function getAuthorisedGroups() $this->_authGroups = array(); } - /* - * Force loading the latest state. - * Otherwise updating the user session fails because it sticks with the 'old' values. - */ - $this->_authGroups = JAccess::getGroupsByUser($this->id); + if (empty($this->_authGroups)) + { + $this->_authGroups = JAccess::getGroupsByUser($this->id); + } return $this->_authGroups; } + /** + * Clears the access rights cache of this user + * + * @return void + * + * @since 3.4.0 + */ + public function clearAccessRíghts() + { + $this->_authLevels = null; + $this->_authGroups = null; + $this->isRoot = null; + JAccess::clearStatics(); + } + /** * Pass through method to the table for setting the last visit date * diff --git a/plugins/system/session/index.html b/plugins/system/session/index.html deleted file mode 100644 index 2efb97f319a35..0000000000000 --- a/plugins/system/session/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/plugins/system/session/session.php b/plugins/system/session/session.php deleted file mode 100644 index ade4ef771ad62..0000000000000 --- a/plugins/system/session/session.php +++ /dev/null @@ -1,134 +0,0 @@ -guest) - { - return; - } - - // Make sure, both plugins are activated or return. - if (JPluginHelper::isEnabled('system', 'session') && !JPluginHelper::isEnabled('user', 'session')) - { - return; - } - - // Read the update flag name to check for. - $plg_params = new Registry(JPluginHelper::getPlugin('user', 'session')->params); - $flag = $plg_params->get('session_update_flag_name', 'refresh'); - - // Get session information. - $session = JFactory::getSession(); - $session_id = $session->getId(); - $session_handler = $this->app->getCfg('session_handler'); - $supported_handlers = array( - 'database', - // 'memcache', - // 'memcached', - 'xcache' - ); - - // Our tweak currently works for selected session storage handlers only. - if (in_array($session_handler, $supported_handlers)) - { - if ($session->get("session.{$flag}", null) == true) - { - $user->groups = JUserHelper::getUserGroups($user->id); - $user->getAuthorisedGroups(); - $user->getAuthorisedViewLevels(); - - // Load session data by id. - $handler = JSessionStorage::getInstance($session_handler); - - if ($db_session = $handler->read($session_id)) - { - // Get the session data. - $session_helper = new JSessionHelper; - $db_session = $session_helper->unserialize($db_session); - - // Populate helper vars. - $sess_namespace = current(array_keys($db_session)); - $sess_data = current(array_values($db_session)); - - // Replace session user data by updated logged in user data to. - $sess_data['user'] = & $user; - - // Store updated session data. - if (false === ($written = $handler->write($session_id, $sess_namespace . '|' . serialize($sess_data)))) - { - throw new RuntimeException(JText::_('PLG_SYSTEM_SESSION_ERROR_STORE_FAIL'), 500); - } - - if (JDEBUG) - { - $this->app->enqueueMessage(JText::sprintf('PLG_SYSTEM_SESSION_ERROR_STORE_SUCCESS_DEBUG', ucfirst($session_handler)), 'notice'); - } - } - else - { - if (JDEBUG) - { - $this->app->enqueueMessage(JText::sprintf('PLG_SYSTEM_SESSION_ERROR_STORE_FAIL_DEBUG', ucfirst($session_handler)), 'error'); - } - } - - // Unset refresh-flag. - $session->set('session.refresh', null); - } - } - else - { - // State the incompatibility so admins might consider to change the selected session handler. - if (JDEBUG) - { - $this->app->enqueueMessage(JText::sprintf('PLG_SYSTEM_SESSION_ERROR_UNSUPPORTED_HANDLER', ucfirst($session_handler)), 'notice'); - } - } - } -} diff --git a/plugins/system/session/session.xml b/plugins/system/session/session.xml deleted file mode 100644 index 18a913a25fe93..0000000000000 --- a/plugins/system/session/session.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - plg_system_session - Joomla! Project - Feb 2014 - Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. - GNU General Public License version 2 or later; see LICENSE.txt - admin@joomla.org - www.joomla.org - 3.4.0 - PLG_SYSTEM_SESSION_XML_DESCRIPTION - - session.php - index.html - - - en-GB/en-GB.plg_system_session.ini - en-GB/en-GB.plg_system_session.sys.ini - - diff --git a/plugins/user/session/index.html b/plugins/user/session/index.html deleted file mode 100644 index 2efb97f319a35..0000000000000 --- a/plugins/user/session/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/plugins/user/session/session.php b/plugins/user/session/session.php deleted file mode 100644 index 2d5f3e62237ae..0000000000000 --- a/plugins/user/session/session.php +++ /dev/null @@ -1,193 +0,0 @@ -app->isAdmin()) - { - // Make sure, both plugins are activated or return. - if (JPluginHelper::isEnabled('user', 'session') && !JPluginHelper::isEnabled('system', 'session')) - { - $this->app->enqueueMessage(JText::_('PLG_USER_SESSION_HINT_ENABLE_BOTH_PLUGINS'), 'notice'); - - return true; - } - - // Dump the processed user's group data for comparison after saving done. - $oldUserData = JFactory::getUser(0); - $oldUserData->setProperties($old); - - $this->oldUserGroups = $oldUserData->get('groups'); - } - - return true; - } - - /** - * Post-process the user data. - * - * @param array $data The saved user data - * @param boolean $isNew Flag indicating whether the data relates to a new user instance - * @param boolean $result The table store result - * @param Exception $error The error that might have occurred while the table data was stored - * - * @return boolean - * - * @since 3.4 - */ - public function onUserAfterSave($data, $isNew, $result, $error) - { - if ($this->app->isAdmin()) - { - // Make sure, both plugins are activated or return. - if (JPluginHelper::isEnabled('user', 'session') && !JPluginHelper::isEnabled('system', 'session')) - { - $this->app->enqueueMessage(JText::_('PLG_USER_SESSION_HINT_ENABLE_BOTH_PLUGINS'), 'notice'); - - return true; - } - - // Get session information. - $session_handler = $this->app->get('session_handler'); - $supported_handlers = array( - 'database', - // 'memcache', - // 'memcached', - 'xcache' - ); - - // Our tweak currently works for selected session storage handlers only. - if (in_array($session_handler, $supported_handlers)) - { - // Check if the processed user's group data has change. - $newUserData = JFactory::getUser(0); - $newUserData->setProperties($data); - - $newUserGroups = $newUserData->get('groups'); - $oldUserGroups = & $this->oldUserGroups; - - $hash_old = hash('md5', serialize(array_values($oldUserGroups))); - $hash_new = hash('md5', serialize(array_values($newUserGroups))); - - // If so, set a flag into the user's session to trigger its session getting updated asap. - if ($hash_old !== $hash_new) - { - // Get id of the user's session. - $session_id = $this->db->setQuery( - $this->db->getQuery(true) - ->select($this->db->quoteName('session_id')) - ->from($this->db->quoteName('#__session')) - ->where($this->db->quoteName('userid') . ' = ' . (int) $newUserData->get('id')) - )->loadResult(); - - if ($session_id) - { - // Get session handler. - $handler = JSessionStorage::getInstance($session_handler); - - // Get name of the update flag to use. - $flag = $this->params->get('session_update_flag_name', 'refresh'); - - // Load session data by id. - if ($session = $handler->read($session_id)) - { - // Unserialize session data. - $session_helper = new JSessionHelper; - $session = $session_helper->unserialize($session); - - // Populate helper vars. - $sess_namespace = current(array_keys($session)); - $sess_data = current(array_values($session)); - - // Set refresh-flag. - $sess_data["session.{$flag}"] = true; - - // Store updated session data. - if (false === ($handler->write($session_id, $sess_namespace . '|' . serialize($sess_data)))) - { - $this->app->enqueueMessage(JText::_('PLG_USER_SESSION_ERROR_STORE_FAIL'), 'error'); - } - - if (JDEBUG) - { - $this->app->enqueueMessage(JText::sprintf('PLG_USER_SESSION_ERROR_STORE_SUCCESS_DEBUG', ucfirst($session_handler)), 'notice'); - } - } - else - { - if (JDEBUG) - { - $this->app->enqueueMessage(JText::sprintf('PLG_USER_SESSION_ERROR_STORE_FAIL_DEBUG', ucfirst($session_handler)), 'error'); - } - } - } - } - } - else - { - // State the incompatibility so admins might consider to change the selected session handler. - if (JDEBUG) - { - $this->app->enqueueMessage(JText::sprintf('PLG_USER_SESSION_ERROR_UNSUPPORTED_HANDLER'), 'warning'); - } - } - - // Delete dumped data. - unset($this->oldUserGroups); - } - - return true; - } -} diff --git a/plugins/user/session/session.xml b/plugins/user/session/session.xml deleted file mode 100644 index 9b1592b5ccb9e..0000000000000 --- a/plugins/user/session/session.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - plg_user_session - Joomla! Project - Feb 2014 - Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved. - GNU General Public License version 2 or later; see LICENSE.txt - admin@joomla.org - www.joomla.org - 3.4.0 - PLG_USER_SESSION_XML_DESCRIPTION - - session.php - index.html - - - en-GB/en-GB.plg_user_session.ini - en-GB/en-GB.plg_user_session.sys.ini - - - -
- -
-
-
-