/** * Apply filter to add or replace attributes. * * Add or replace existing attributes with the configured values. * * @param array &$request The current request */ public function process(&$request) { assert('is_array($request)'); assert('array_key_exists("Attributes", $request)'); $attributes =& $request['Attributes']; $attrlang = NULL; if (array_key_exists($this->langattr, $attributes)) { $attrlang = $attributes[$this->langattr][0]; } $config = SimpleSAML_Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($config, 'frontpage'); $lang = $t->getLanguage(FALSE, FALSE); if (isset($attrlang)) { SimpleSAML_Logger::debug('LanguageAdaptor: Language in attribute was set [' . $attrlang . ']'); } if (isset($lang)) { SimpleSAML_Logger::debug('LanguageAdaptor: Language in session was set [' . $lang . ']'); } if (isset($attrlang)) { if (!isset($lang)) { $t->setLanguage($attrlang); $_GET['language'] = $attrlang; } else { // Language was set in both attributes and session. if ($lang !== $attrlang) { // Different language set in attributes and session. } } } else { if (isset($lang)) { $request['Attributes'][$this->langattr] = array($lang); } else { // Language was neighter set in attributes or in session } } }
$history = $mcontroller->getHistory(10, $history_size); foreach ($history as $data) { $rid = $data->getRevisionid(); $rnote = $data->getRevisionnote(); $output .= '<section class="revision"><a href="?eid=' . $data->getEid() . '&revisionid=' . $rid . '">' . $et->t('tab_edit_entity_connection_revision') . ' ' . $rid . '</a>'; if ($data->getRevisionid() !== $currentRevisionId) { $output .= ' - <a class="janus_button" href="?compareRevision=true&eid=' . $data->getEid() . '&compareRevisiondid=' . $data->getRevisionid() . '&revisionid=' . $currentRevisionId . '&selectedtab=' . $historyTab . '">Revision history</a>'; } $output .= strlen($rnote) > 80 ? ' - ' . substr($rnote, 0, 79) . '...' : ' - ' . $rnote; // Show edit user if present $user->setUid($data->getUser()); if ($user->load()) { $output .= ' - ' . $user->getUserid(); } $output .= ' - ' . date('Y-m-d H:i', strtotime($data->getCreated())); if (isset($workflowstates[$data->getWorkflow()]['name'][$et->getLanguage()])) { $curLang = $et->getLanguage(); } else { $curLang = 'en'; } if (isset($workflowstates[$data->getWorkflow()]['name'][$curLang])) { $output .= ' - ' . $workflowstates[$data->getWorkflow()]['name'][$curLang]; } else { $output .= ' - ' . $data->getWorkflow(); } $output .= '</revision>'; } } else { $output .= $et->t('error_no_access'); } echo $output;
/** * @param SimpleSAML_XHTML_Template $template */ public function __construct($template) { $this->template = $template; $this->languageCode = $template->getLanguage(); }
} } else { // Revision not set, get latest if (!($entity = $entityController->setEntity($eid))) { throw new SimpleSAML_Error_Exception('Error in setEntity'); } } // load entity $entityController->loadEntity(); // Check if user is allowed to se entity $securityContext = \sspmod_janus_DiContainer::getInstance()->getSecurityContext(); if (!$securityContext->isGranted('access', $entity)) { SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/index.php')); } $et = new SimpleSAML_XHTML_Template($config, 'janus:editentity.php', 'janus:editentity'); $language = $et->getLanguage(); $update = FALSE; function markForUpdate() { global $update; $update = true; } $note = ''; if (!empty($_POST)) { // Whether to redirect to importing. $redirectToImport = false; // Array for collecting addresses to notify $addresses = array(); $csrf_provider = sspmod_janus_DiContainer::getInstance()->getCsrfProvider(); if (empty($_POST['csrf_token']) || !$csrf_provider->isCsrfTokenValid('entity_update', $_POST['csrf_token'])) { SimpleSAML_Logger::warning('Janus: [SECURITY] Valid CSRF token not found');