本文整理汇总了PHP中SimpleSAML_XHTML_Template类的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_XHTML_Template类的具体用法?PHP SimpleSAML_XHTML_Template怎么用?PHP SimpleSAML_XHTML_Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleSAML_XHTML_Template类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showException
private function showException($e)
{
$globalConfig = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'attributefromrestapi:exception.tpl.php');
$t->data['e'] = $e->getMessage();
$t->show();
exit;
}
示例2: show
function show()
{
$t = new SimpleSAML_XHTML_Template($this->config, 'widget.php', 'foodle_foodle');
$t->data['bread'] = array(array('href' => '/' . $this->config->getValue('baseurlpath'), 'title' => 'bc_frontpage'), array('title' => 'Support'));
$t->data['gmapsAPI'] = $this->config->getValue('gmapsAPI');
$t->data['optimize'] = $this->config->getValue('optimize', false);
$t->show();
}
示例3: authFailed
/**
* Finish a failed authentication.
*
* This function can be overloaded by a child authentication
* class that wish to perform some operations on failure
*
* @param array &$state Information about the current authentication.
*/
public function authFailed(&$state)
{
$config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'authX509:X509error.php');
$t->data['errorcode'] = $state['authX509.error'];
$t->show();
exit;
}
示例4: show
/**
* Show the error to the user.
*
* This function does not return.
*/
public function show()
{
header('HTTP/1.0 500 Internal Server Error');
$this->logError();
$globalConfig = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'core:no_metadata.tpl.php');
$t->data['entityId'] = $this->entityId;
$t->show();
exit;
}
示例5: sendResponse
/**
* Send an authenticationResponse using HTTP-POST.
*
* @param string $response The response which should be sent.
* @param array $idpmd The metadata of the IdP which is sending the response.
* @param array $spmd The metadata of the SP which is receiving the response.
* @param string|NULL $relayState The relaystate for the SP.
* @param string $shire The shire which should receive the response.
*/
public function sendResponse($response, $idpmd, $spmd, $relayState, $shire)
{
SimpleSAML_Utilities::validateXMLDocument($response, 'saml11');
$privatekey = SimpleSAML_Utilities::loadPrivateKey($idpmd, TRUE);
$publickey = SimpleSAML_Utilities::loadPublicKey($idpmd, TRUE);
$responsedom = new DOMDocument();
$responsedom->loadXML(str_replace("\r", "", $response));
$responseroot = $responsedom->getElementsByTagName('Response')->item(0);
$firstassertionroot = $responsedom->getElementsByTagName('Assertion')->item(0);
/* Determine what we should sign - either the Response element or the Assertion. The default
* is to sign the Assertion, but that can be overridden by the 'signresponse' option in the
* SP metadata or 'saml20.signresponse' in the global configuration.
*/
$signResponse = FALSE;
if (array_key_exists('signresponse', $spmd) && $spmd['signresponse'] !== NULL) {
$signResponse = $spmd['signresponse'];
if (!is_bool($signResponse)) {
throw new Exception('Expected the \'signresponse\' option in the metadata of the' . ' SP \'' . $spmd['entityid'] . '\' to be a boolean value.');
}
} else {
$signResponse = $this->configuration->getBoolean('shib13.signresponse', TRUE);
}
/* Check if we have an assertion to sign. Force to sign the response if not. */
if ($firstassertionroot === NULL) {
$signResponse = TRUE;
}
$signer = new SimpleSAML_XML_Signer(array('privatekey_array' => $privatekey, 'publickey_array' => $publickey, 'id' => $signResponse ? 'ResponseID' : 'AssertionID'));
if (array_key_exists('certificatechain', $idpmd)) {
$signer->addCertificate($idpmd['certificatechain']);
}
if ($signResponse) {
/* Sign the response - this must be done after encrypting the assertion. */
/* We insert the signature before the saml2p:Status element. */
$statusElements = SimpleSAML_Utilities::getDOMChildren($responseroot, 'Status', '@saml1p');
assert('count($statusElements) === 1');
$signer->sign($responseroot, $responseroot, $statusElements[0]);
} else {
/* Sign the assertion */
$signer->sign($firstassertionroot, $firstassertionroot);
}
$response = $responsedom->saveXML();
if ($this->configuration->getBoolean('debug', FALSE)) {
$p = new SimpleSAML_XHTML_Template($this->configuration, 'post-debug.php');
$p->data['header'] = 'SAML (Shibboleth 1.3) Response Debug-mode';
$p->data['RelayStateName'] = 'TARGET';
$p->data['RelayState'] = $relayState;
$p->data['destination'] = $shire;
$p->data['response'] = str_replace("\n", "", base64_encode($response));
$p->data['responseHTML'] = htmlspecialchars(SimpleSAML_Utilities::formatXMLString($response));
$p->show();
} else {
SimpleSAML_Utilities::postRedirect($shire, array('TARGET' => $relayState, 'SAMLResponse' => base64_encode($response)));
}
}
示例6: simplesamlphp_get_entry_name
/**
* Gets the name value from an entry array.
*
* @param SimpleSAML_XHTML_Template $view The view object.
* @param array $entry The entry array.
*
* @return string The resulting name value.
*/
function simplesamlphp_get_entry_name($view, $entry = array())
{
$result = $entry['entityid'];
if (!empty($entry['name'])) {
$name = SimpleSAML\Utils\Arrays::arrayize($entry['name'], 'en');
$result = $view->getTranslation($name);
} elseif (!empty($entry['OrganizationDisplayName'])) {
$name = SimpleSAML\Utils\Arrays::arrayize($entry['OrganizationDisplayName'], 'en');
$result = $view->getTranslation($name);
}
return htmlspecialchars($result);
}
示例7: present_attributes
function present_attributes(SimpleSAML_XHTML_Template $t, $attributes, $nameParent)
{
$alternate = array('odd', 'even');
$i = 0;
$parentStr = strlen($nameParent) > 0 ? strtolower($nameParent) . '_' : '';
$str = strlen($nameParent) > 0 ? '<table class="attributes" summary="attribute overview">' : '<table id="table_with_attributes" class="attributes" summary="attribute overview">';
foreach ($attributes as $name => $value) {
$nameraw = $name;
$name = $t->getTranslator()->getAttributeTranslation($parentStr . $nameraw);
if (preg_match('/^child_/', $nameraw)) {
$parentName = preg_replace('/^child_/', '', $nameraw);
foreach ($value as $child) {
$str .= '<tr class="odd"><td colspan="2" style="padding: 2em">' . present_attributes($t, $child, $parentName) . '</td></tr>';
}
} else {
if (sizeof($value) > 1) {
$str .= '<tr class="' . $alternate[$i++ % 2] . '"><td class="attrname">';
if ($nameraw !== $name) {
$str .= htmlspecialchars($name) . '<br/>';
}
$str .= '<tt>' . htmlspecialchars($nameraw) . '</tt>';
$str .= '</td><td class="attrvalue"><ul>';
foreach ($value as $listitem) {
if ($nameraw === 'jpegPhoto') {
$str .= '<li><img src="data:image/jpeg;base64,' . htmlspecialchars($listitem) . '" /></li>';
} else {
$str .= '<li>' . present_assoc($listitem) . '</li>';
}
}
$str .= '</ul></td></tr>';
} elseif (isset($value[0])) {
$str .= '<tr class="' . $alternate[$i++ % 2] . '"><td class="attrname">';
if ($nameraw !== $name) {
$str .= htmlspecialchars($name) . '<br/>';
}
$str .= '<tt>' . htmlspecialchars($nameraw) . '</tt>';
$str .= '</td>';
if ($nameraw === 'jpegPhoto') {
$str .= '<td class="attrvalue"><img src="data:image/jpeg;base64,' . htmlspecialchars($value[0]) . '" /></td></tr>';
} else {
$str .= '<td class="attrvalue">' . htmlspecialchars($value[0]) . '</td></tr>';
}
}
}
$str .= "\n";
}
$str .= '</table>';
return $str;
}
示例8: show
function show()
{
if (isset($_REQUEST['save'])) {
$this->saveChanges();
}
$t = new SimpleSAML_XHTML_Template($this->config, 'foodlecreate.php', 'foodle_foodle');
$t->data['optimize'] = $this->config->getValue('optimize', false);
$t->data['user'] = $this->user;
$t->data['userToken'] = $this->user->getToken();
$t->data['loginurl'] = $this->auth->getLoginURL();
$t->data['logouturl'] = $this->auth->getLogoutURL('/');
$t->data['authenticated'] = $this->auth->isAuth();
$t->data['foodleid'] = $this->foodle->identifier;
$t->data['gmapsAPI'] = $this->config->getValue('gmapsAPI');
$t->data['bread'] = array(array('href' => '/', 'title' => 'bc_frontpage'), array('href' => '/foodle/' . $this->foodle->identifier, 'title' => $this->foodle->name), array('title' => 'bc_edit'));
$t->show();
}
示例9: show
public static function show($path = '/simplesaml/module.php/discojuice/discojuice/') {
$djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuicecentral.php');
$config = SimpleSAML_Configuration::getInstance();
$feed = new sspmod_discojuice_Feed();
$metadata = json_decode($feed->read(), TRUE);
$t = new SimpleSAML_XHTML_Template($config, 'discojuice:central.tpl.php');
$t->data['metadata'] = $metadata;
$t->data['discojuice.options'] = $djconfig->getValue('discojuice.options');
$t->data['discojuice.options']['discoPath'] = $path;
$t->data['acl'] = $djconfig->getValue('acl');
$t->show();
}
示例10: show
function show()
{
$stats = $this->fdb->getStats();
$t = new SimpleSAML_XHTML_Template($this->config, 'foodlefront.php', 'foodle_foodle');
$t->data['optimize'] = $this->config->getValue('optimize', false);
$t->data['gmapsAPI'] = $this->config->getValue('gmapsAPI');
$t->data['bread'] = array(array('title' => 'bc_frontpage'));
$t->data['user'] = $this->user;
$t->data['authenticated'] = $this->auth->isAuth();
if ($this->auth->isAuth()) {
$t->data['userToken'] = $this->user->getToken();
}
$t->data['loginurl'] = $this->auth->getLoginURL();
$t->data['logouturl'] = $this->auth->getLogoutURL();
$t->data['enableFacebookAuth'] = $this->config->getValue('enableFacebookAuth', TRUE);
$t->data['stats'] = $stats;
$t->show();
}
示例11: show
function show()
{
$t = new SimpleSAML_XHTML_Template($this->config, 'support.php', 'foodle_foodle');
$t->data['bread'] = array(array('href' => '/' . $this->config->getValue('baseurlpath'), 'title' => 'bc_frontpage'), array('title' => 'Support'));
$t->data['gmapsAPI'] = $this->config->getValue('gmapsAPI');
$t->data['optimize'] = $this->config->getValue('optimize', false);
// $t->data['user'] = $this->user;
// $t->data['userid'] = $this->user->userid;
// $t->data['displayname'] = $this->user->username;
$t->data['authenticated'] = $this->auth->isAuth();
// FastPass::$domain = "tjenester.ecampus.no";
// $t->data['getsatisfactionscript'] = FastPass::script(
// $this->config->getValue('getsatisfaction.key'), $this->config->getValue('getsatisfaction.secret'),
// $this->user->email, $this->user->username, $this->user->userid);
// $t->data['loginurl'] = $this->auth->getLoginURL();
// $t->data['url'] = $this->auth->getURL();
$t->data['loginurl'] = $this->auth->getLoginURL();
$t->data['logouturl'] = $this->auth->getLogoutURL();
$t->show();
}
示例12: show
function show()
{
$entries = $this->fdb->getYourEntries($this->user);
$statstotal = $this->fdb->getStatsRealm();
$statsweek = $this->fdb->getStatsRealm(60 * 60 * 24 * 7);
$statsday = $this->fdb->getStatsRealm(60 * 60 * 24);
$totals = array('total' => 0, 'week' => 0, 'day' => 0);
$stats = array();
foreach ($statstotal as $s) {
$stats[$s['realm']] = array('total' => $s);
$totals['total'] += $s['c'];
}
foreach ($statsweek as $s) {
$stats[$s['realm']]['week'] = $s;
$totals['week'] += $s['c'];
}
foreach ($statsday as $s) {
$stats[$s['realm']]['day'] = $s;
$totals['day'] += $s['c'];
}
$realm = NULL;
if (!empty($_REQUEST['realm']) && array_key_exists($_REQUEST['realm'], $stats)) {
$realm = $_REQUEST['realm'];
}
$users = $this->fdb->getRecentUsers($realm);
// ---- o ----- o ---- o ----- o ---- o ----- o
$t = new SimpleSAML_XHTML_Template($this->config, 'stats.php', 'foodle_foodle');
$t->data['optimize'] = $this->config->getValue('optimize', false);
$t->data['showsupport'] = TRUE;
$t->data['gmapsAPI'] = $this->config->getValue('gmapsAPI');
$t->data['loginurl'] = $this->auth->getLoginURL();
$t->data['logouturl'] = $this->auth->getLogoutURL();
$t->data['bread'] = array(array('href' => '/' . $this->config->getValue('baseurlpath'), 'title' => 'bc_frontpage'), array('href' => '/stats', 'title' => 'Statistics'));
$t->data['user'] = $this->user;
$t->data['users'] = $users;
$t->data['statsrealm'] = $stats;
$t->data['totalsrealm'] = $totals;
$t->show();
}
示例13: show
function show()
{
if (isset($_REQUEST['save'])) {
$this->saveChanges();
}
if (isset($_REQUEST['col'])) {
$this->foodle->fixDate($_REQUEST['col']);
}
$t = new SimpleSAML_XHTML_Template($this->config, 'fixdate.php', 'foodle_foodle');
$t->data['authenticated'] = $this->auth->isAuth();
$t->data['user'] = $this->user;
$t->data['timezone'] = $this->timezone;
$t->data['ftimezone'] = $this->foodle->timezone;
$t->data['name'] = $this->foodle->name;
$t->data['identifier'] = $this->foodle->identifier;
$t->data['descr'] = $this->foodle->descr;
$t->data['foodle'] = $this->foodle;
$t->data['today'] = date('Y-m-d');
$t->data['tomorrow'] = date('Y-m-d', time() + 60 * 60 * 24);
$t->data['bread'] = array(array('href' => '/', 'title' => 'bc_frontpage'), array('href' => '/foodle/' . $this->foodle->identifier . '#responses', 'title' => $this->foodle->name), array('title' => 'Fix timeslot'));
$t->show();
}
示例14: show
/**
* Show the error to the user.
*
* This function does not return.
*/
public function show()
{
header('HTTP/1.0 500 Internal Server Error');
$errorData = $this->saveError();
$session = SimpleSAML_Session::getInstance();
$attributes = $session->getAttributes();
if (isset($attributes['mail'][0])) {
$email = $attributes['mail'][0];
} else {
$email = '';
}
$globalConfig = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'core:no_state.tpl.php');
/* Enable error reporting if we have a valid technical contact email. */
if ($globalConfig->getString('technicalcontact_email', 'na@example.org') !== 'na@example.org') {
/* Enable error reporting. */
$baseurl = SimpleSAML_Utilities::getBaseURL();
$t->data['errorReportAddress'] = $baseurl . 'errorreport.php';
$t->data['reportId'] = $errorData['reportId'];
$t->data['email'] = $email;
}
$t->show();
exit;
}
示例15: process
/**
* 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
}
}
}