$readOnly = false; foreach ($this->shares as $share) { if (User::get('username') == $share->viewuser) { if (strtolower($share->readonly) == 'yes') { $readOnly = true; } } } include_once PATH_CORE . DS . 'components' . DS . 'com_tools' . DS . 'tables' . DS . 'preferences.php'; $database = App::get('db'); $preferences = new \Components\Tools\Tables\Preferences($database); $preferences->loadByUser(User::get('id')); $declared = Request::getWord('viewer'); if ($declared) { if (Request::getInt('preferred', 0)) { $preferences->set('user_id', User::get('id')); $preferences->param()->set('viewer', $declared); $preferences->store(); } } else { if ($declared = $preferences->param('viewer')) { Request::setVar('viewer', $declared); } } // We actually need to do this first so we know what viewer is the active one. $output = Event::trigger('tools.onToolSessionView', array($this->app, $this->output, $readOnly)); $plugins = Event::trigger('tools.onToolSessionIdentify'); $this->css('tools.css')->js('sessions.js'); ?> <header id="content-header"> <h2><?php