Behave like Language->noop to mark a tag for translation but actually do it later.
public static noop ( $tag ) |
} $metaArray['OrganizationURL'] = $idpmeta->getLocalizedString('OrganizationURL'); } $metaflat = '$metadata[' . var_export($idpentityid, true) . '] = ' . var_export($metaArray, true) . ';'; $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($idpentityid); $metaBuilder->addMetadataIdP11($metaArray); $metaBuilder->addOrganizationInfo($metaArray); $metaBuilder->addContact('technical', \SimpleSAML\Utils\Config\Metadata::getContact(array('emailAddress' => $config->getString('technicalcontact_email', null), 'name' => $config->getString('technicalcontact_name', null), 'contactType' => 'technical'))); $metaxml = $metaBuilder->getEntityDescriptorText(); // sign the metadata if enabled $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $idpmeta->toArray(), 'Shib 1.3 IdP'); if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') { $defaultidp = $config->getString('default-shib13-idp', null); $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); $t->data['clipboard.js'] = true; $t->data['header'] = 'shib13-idp'; // TODO: Replace with headerString in 2.0 $t->data['headerString'] = $t->noop('metadata_shib13-idp'); $t->data['metaurl'] = \SimpleSAML\Utils\HTTP::addURLParameters(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery(), array('output' => 'xml')); $t->data['metadata'] = htmlspecialchars($metaxml); $t->data['metadataflat'] = htmlspecialchars($metaflat); $t->data['defaultidp'] = $defaultidp; $t->show(); } else { header('Content-Type: application/xml'); echo $metaxml; exit(0); } } catch (Exception $exception) { throw new SimpleSAML_Error_Error('METADATA', $exception); }
} $output_xhtml = array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml'; $metaxml = $metaBuilder->getEntityDescriptorText($output_xhtml); if (!$output_xhtml) { $metaxml = str_replace("\n", '', $metaxml); } // sign the metadata if enabled $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $idpmeta->toArray(), 'ADFS IdP'); if ($output_xhtml) { $defaultidp = $config->getString('default-adfs-idp', null); $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); $t->data['clipboard.js'] = true; $t->data['available_certs'] = $availableCerts; $t->data['header'] = 'adfs-idp'; // TODO: Replace with headerString in 2.0 $t->data['headerString'] = $t->noop('metadata_adfs-idp'); $t->data['metaurl'] = \SimpleSAML\Utils\HTTP::getSelfURLNoQuery(); $t->data['metadata'] = htmlspecialchars($metaxml); $t->data['metadataflat'] = htmlspecialchars($metaflat); $t->data['defaultidp'] = $defaultidp; $t->show(); } else { header('Content-Type: application/xml'); // make sure to export only the md:EntityDescriptor $metaxml = substr($metaxml, strpos($metaxml, '<md:EntityDescriptor')); // 22 = strlen('</md:EntityDescriptor>') $metaxml = substr($metaxml, 0, strrpos($metaxml, '</md:EntityDescriptor>') + 22); echo $metaxml; exit(0); } } catch (Exception $exception) {
} } if ($config->getBoolean('enable.adfs-idp', FALSE) === true) { try { $metaentries['hosted']['adfs-idp'] = $metadata->getMetaDataCurrent('adfs-idp-hosted'); $metaentries['hosted']['adfs-idp']['metadata-url'] = SimpleSAML\Module::getModuleURL('adfs/idp/metadata.php', array('output' => 'xhtml')); if ($isadmin) { $metaentries['remote']['adfs-sp-remote'] = $metadata->getList('adfs-sp-remote'); } } catch (Exception $e) { } } foreach ($metaentries['remote'] as $key => $value) { if (empty($value)) { unset($metaentries['remote'][$key]); } } $t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_federation.tpl.php'); # look up translated string $mtype = array('saml20-sp-remote' => $t->noop('{admin:metadata_saml20-sp}'), 'saml20-sp-hosted' => $t->noop('{admin:metadata_saml20-sp}'), 'saml20-idp-remote' => $t->noop('{admin:metadata_saml20-idp}'), 'saml20-idp-hosted' => $t->noop('{admin:metadata_saml20-idp}'), 'shib13-sp-remote' => $t->noop('{admin:metadata_shib13-sp}'), 'shib13-sp-hosted' => $t->noop('{admin:metadata_shib13-sp}'), 'shib13-idp-remote' => $t->noop('{admin:metadata_shib13-idp}'), 'shib13-idp-hosted' => $t->noop('{admin:metadata_shib13-idp}'), 'adfs-sp-remote' => $t->noop('{admin:metadata_adfs-sp}'), 'adfs-sp-hosted' => $t->noop('{admin:metadata_adfs-sp}'), 'adfs-idp-remote' => $t->noop('{admin:metadata_adfs-idp}'), 'adfs-idp-hosted' => $t->noop('{admin:metadata_adfs-idp}')); $t->data['pageid'] = 'frontpage_federation'; $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; $t->data['links'] = $links; $t->data['links_welcome'] = $links_welcome; $t->data['links_config'] = $links_config; $t->data['links_auth'] = $links_auth; $t->data['links_federation'] = $links_federation; $t->data['metaentries'] = $metaentries; $t->data['mtype'] = $mtype; $t->show();
} /* Some basic configuration checks */ if ($config->getString('technicalcontact_email', '*****@*****.**') === '*****@*****.**') { $mail_ok = FALSE; } else { $mail_ok = TRUE; } $funcmatrix[] = array('required' => 'recommended', 'descr' => 'technicalcontact_email option set', 'enabled' => $mail_ok); if ($config->getString('auth.adminpassword', '123') === '123') { $password_ok = FALSE; } else { $password_ok = TRUE; } $funcmatrix[] = array('required' => 'required', 'descr' => 'auth.adminpassword option set', 'enabled' => $password_ok); $funcmatrix[] = array('required' => 'recommended', 'descr' => 'Magic Quotes should be turned off', 'enabled' => get_magic_quotes_runtime() == 0); $t = new SimpleSAML_XHTML_Template($config, 'core:frontpage_config.tpl.php'); $t->data['pageid'] = 'frontpage_config'; $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; $t->data['warnings'] = $warnings; $t->data['links'] = $links; $t->data['links_welcome'] = $links_welcome; $t->data['links_config'] = $links_config; $t->data['links_auth'] = $links_auth; $t->data['links_federation'] = $links_federation; $t->data['enablematrix'] = $enablematrix; $t->data['funcmatrix'] = $funcmatrix; $t->data['requiredmap'] = array('recommended' => $t->noop('{core:frontpage:recommended}'), 'required' => $t->noop('{core:frontpage:required}'), 'optional' => $t->noop('{core:frontpage:optional}')); $t->data['version'] = $config->getVersion(); $t->data['directory'] = dirname(dirname(dirname(dirname(__FILE__)))); $t->show();
} } } } } } } } return $output; } $config = SimpleSAML_Configuration::getInstance(); // Make sure that the user has admin access rights SimpleSAML\Utils\Auth::requireAdmin(); $formats = array('bytes' => 'humanreadable', 'bytes_read' => 'humanreadable', 'bytes_written' => 'humanreadable', 'limit_maxbytes' => 'humanreadable', 'time' => 'tdate', 'uptime' => 'hours'); $statsraw = SimpleSAML_Memcache::getStats(); $stats = $statsraw; foreach ($stats as $key => &$entry) { if (array_key_exists($key, $formats)) { $func = $formats[$key]; foreach ($entry as $k => $val) { $entry[$k] = $func($val); } } } $t = new SimpleSAML_XHTML_Template($config, 'memcacheMonitor:memcachestat.tpl.php'); $rowTitles = array('accepting_conns' => $t->noop('{memcacheMonitor:memcachestat:accepting_conns}'), 'auth_cmds' => $t->noop('{memcacheMonitor:memcachestat:auth_cmds}'), 'auth_errors' => $t->noop('{memcacheMonitor:memcachestat:auth_errors}'), 'bytes' => $t->noop('{memcacheMonitor:memcachestat:bytes}'), 'bytes_read' => $t->noop('{memcacheMonitor:memcachestat:bytes_read}'), 'bytes_written' => $t->noop('{memcacheMonitor:memcachestat:bytes_written}'), 'cas_badval' => $t->noop('{memcacheMonitor:memcachestat:cas_badval}'), 'cas_hits' => $t->noop('{memcacheMonitor:memcachestat:cas_hits}'), 'cas_misses' => $t->noop('{memcacheMonitor:memcachestat:cas_misses}'), 'cmd_get' => $t->noop('{memcacheMonitor:memcachestat:cmd_get}'), 'cmd_set' => $t->noop('{memcacheMonitor:memcachestat:cmd_set}'), 'connection_structures' => $t->noop('{memcacheMonitor:memcachestat:connection_structures}'), 'conn_yields' => $t->noop('{memcacheMonitor:memcachestat:conn_yields}'), 'curr_connections' => $t->noop('{memcacheMonitor:memcachestat:curr_connections}'), 'curr_items' => $t->noop('{memcacheMonitor:memcachestat:curr_items}'), 'decr_hits' => $t->noop('{memcacheMonitor:memcachestat:decr_hits}'), 'decr_misses' => $t->noop('{memcacheMonitor:memcachestat:decr_misses}'), 'delete_hits' => $t->noop('{memcacheMonitor:memcachestat:delete_hits}'), 'delete_misses' => $t->noop('{memcacheMonitor:memcachestat:delete_misses}'), 'evictions' => $t->noop('{memcacheMonitor:memcachestat:evictions}'), 'get_hits' => $t->noop('{memcacheMonitor:memcachestat:get_hits}'), 'get_misses' => $t->noop('{memcacheMonitor:memcachestat:get_misses}'), 'incr_hits' => $t->noop('{memcacheMonitor:memcachestat:incr_hits}'), 'incr_misses' => $t->noop('{memcacheMonitor:memcachestat:incr_misses}'), 'limit_maxbytes' => $t->noop('{memcacheMonitor:memcachestat:limit_maxbytes}'), 'listen_disabled_num' => $t->noop('{memcacheMonitor:memcachestat:listen_disabled_num}'), 'pid' => $t->noop('{memcacheMonitor:memcachestat:pid}'), 'pointer_size' => $t->noop('{memcacheMonitor:memcachestat:pointer_size}'), 'rusage_system' => $t->noop('{memcacheMonitor:memcachestat:rusage_system}'), 'rusage_user' => $t->noop('{memcacheMonitor:memcachestat:rusage_user}'), 'threads' => $t->noop('{memcacheMonitor:memcachestat:threads}'), 'time' => $t->noop('{memcacheMonitor:memcachestat:time}'), 'total_connections' => $t->noop('{memcacheMonitor:memcachestat:total_connections}'), 'total_items' => $t->noop('{memcacheMonitor:memcachestat:total_items}'), 'uptime' => $t->noop('{memcacheMonitor:memcachestat:uptime}'), 'version' => $t->noop('{memcacheMonitor:memcachestat:version}')); $t->data['title'] = 'Memcache stats'; $t->data['rowtitles'] = $rowTitles; $t->data['table'] = $stats; $t->data['statsraw'] = $statsraw; $t->show();
$techcontact['contactType'] = 'technical'; $metaArray['contacts'][] = Metadata::getContact($techcontact); } $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($idpentityid); $metaBuilder->addMetadataIdP20($metaArray); $metaBuilder->addOrganizationInfo($metaArray); $metaxml = $metaBuilder->getEntityDescriptorText(); $metaflat = '$metadata[' . var_export($idpentityid, true) . '] = ' . var_export($metaArray, true) . ';'; // sign the metadata if enabled $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $idpmeta->toArray(), 'SAML 2 IdP'); if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') { $defaultidp = $config->getString('default-saml20-idp', null); $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin'); $t->data['clipboard.js'] = true; $t->data['available_certs'] = $availableCerts; $t->data['header'] = 'saml20-idp'; // TODO: Replace with headerString in 2.0 $t->data['headerString'] = $t->noop('metadata_saml20-idp'); $t->data['metaurl'] = HTTP::getSelfURLNoQuery(); $t->data['metadata'] = htmlspecialchars($metaxml); $t->data['metadataflat'] = htmlspecialchars($metaflat); $t->data['defaultidp'] = $defaultidp; $t->show(); } else { header('Content-Type: application/xml'); echo $metaxml; exit(0); } } catch (Exception $exception) { throw new SimpleSAML_Error_Error('METADATA', $exception); }
/** * Handles a request to this discovery service. * * The IdP disco parameters should be set before calling this function. */ public function handleRequest() { $this->start(); // no choice made. Show discovery service page $idpList = $this->getIdPList(); $idpList = $this->idplistStructured($this->filterList($idpList)); $preferredIdP = $this->getRecommendedIdP(); $faventry = NULL; foreach ($idpList as $tab => $slist) { if (!empty($preferredIdP) && array_key_exists($preferredIdP, $slist)) { $faventry = $slist[$preferredIdP]; } } $t = new SimpleSAML_XHTML_Template($this->config, 'discopower:disco.tpl.php', 'disco'); $discoPowerTabs = array('denmark' => $t->noop('{discopower:tabs:denmark}'), 'edugain' => $t->noop('{discopower:tabs:edugain}'), 'finland' => $t->noop('{discopower:tabs:finland}'), 'greece' => $t->noop('{discopower:tabs:greece}'), 'iceland' => $t->noop('{discopower:tabs:iceland}'), 'incommon' => $t->noop('{discopower:tabs:incommon}'), 'kalmar' => $t->noop('{discopower:tabs:kalmar}'), 'misc' => $t->noop('{discopower:tabs:misc}'), 'norway' => $t->noop('{discopower:tabs:norway}'), 'sweden' => $t->noop('{discopower:tabs:sweden}'), 'switzerland' => $t->noop('{discopower:tabs:switzerland}'), 'ukacessfederation' => $t->noop('{discopower:tabs:ukacessfederation}')); $t->data['faventry'] = $faventry; $t->data['tabNames'] = $discoPowerTabs; $t->data['idplist'] = $idpList; $t->data['preferredidp'] = $preferredIdP; $t->data['return'] = $this->returnURL; $t->data['returnIDParam'] = $this->returnIdParam; $t->data['entityID'] = $this->spEntityId; $t->data['urlpattern'] = htmlspecialchars(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery()); $t->data['rememberenabled'] = $this->config->getBoolean('idpdisco.enableremember', false); $t->data['rememberchecked'] = $this->config->getBoolean('idpdisco.rememberchecked', false); $t->data['defaulttab'] = $this->discoconfig->getValue('defaulttab', 0); $t->data['score'] = $this->discoconfig->getValue('score', 'quicksilver'); $t->show(); }