当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleSAML_XHTML_Template::t方法代码示例

本文整理汇总了PHP中SimpleSAML_XHTML_Template::t方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_XHTML_Template::t方法的具体用法?PHP SimpleSAML_XHTML_Template::t怎么用?PHP SimpleSAML_XHTML_Template::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleSAML_XHTML_Template的用法示例。


在下文中一共展示了SimpleSAML_XHTML_Template::t方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Exception

$config = SimpleSAML_Configuration::getInstance();
$janus_config = sspmod_janus_DiContainer::getInstance()->getConfig();
$authsource = $janus_config->getValue('auth', 'login-admin');
$useridattr = $janus_config->getValue('useridattr', 'eduPersonPrincipalName');
$et = new SimpleSAML_XHTML_Template($config, 'janus:editentity.php', 'janus:editentity');
$as = new SimpleSAML_Auth_Simple($authsource);
// Validate user
if ($as->isAuthenticated()) {
    $attributes = $as->getAttributes();
    // Check if userid exists
    if (!isset($attributes[$useridattr])) {
        throw new Exception('User ID is missing');
    }
    $userid = $attributes[$useridattr][0];
} else {
    echo $et->t('error_no_access');
    exit;
}
// Get Entity controller
$mcontroller = sspmod_janus_DiContainer::getInstance()->getEntityController();
// Get the user
$user = new sspmod_janus_User();
$user->setUserid($userid);
$user->load(sspmod_janus_User::USERID_LOAD);
$eid = $_GET['eid'];
$currentRevisionId = $_GET['currentRevisionId'];
$historyTab = $_GET['historyTab'];
if (!($entity = $mcontroller->setEntity($eid))) {
    throw new SimpleSAML_Error_Exception('Error in setEntity');
}
$workflowstates = $janus_config->getValue('workflowstates');
开发者ID:janus-ssp,项目名称:janus,代码行数:31,代码来源:history.php

示例2: present_attributes

/**
 * Recursiv attribute array listing function
 *
 * @param SimpleSAML_XHTML_Template $t          Template object
 * @param array                     $attributes Attributes to be presented
 * @param string                    $nameParent Name of parent element
 *
 * @return string HTML representation of the attributes 
 */
function present_attributes($t, $attributes, $nameParent)
{
    $alternate = array('odd', 'even');
    $i = 0;
    $summary = 'summary="' . $t->t('{consent:consent:table_summary}') . '"';
    if (strlen($nameParent) > 0) {
        $parentStr = strtolower($nameParent) . '_';
        $str = '<table class="attributes" ' . $summary . '>';
    } else {
        $parentStr = '';
        $str = '<table id="table_with_attributes"  class="attributes" ' . $summary . '>';
        $str .= "\n" . '<caption>' . $t->t('{consent:consent:table_caption}') . '</caption>';
    }
    foreach ($attributes as $name => $value) {
        $nameraw = $name;
        $name = $t->getAttributeTranslation($parentStr . $nameraw);
        if (preg_match('/^child_/', $nameraw)) {
            // Insert child table
            $parentName = preg_replace('/^child_/', '', $nameraw);
            foreach ($value as $child) {
                $str .= "\n" . '<tr class="odd"><td style="padding: 2em">' . present_attributes($t, $child, $parentName) . '</td></tr>';
            }
        } else {
            // Insert values directly
            $str .= "\n" . '<tr class="' . $alternate[$i++ % 2] . '"><td><span class="attrname">' . htmlspecialchars($name) . '</span>';
            $isHidden = in_array($nameraw, $t->data['hiddenAttributes'], true);
            if ($isHidden) {
                $hiddenId = SimpleSAML_Utilities::generateID();
                $str .= '<div class="attrvalue" style="display: none;" id="hidden_' . $hiddenId . '">';
            } else {
                $str .= '<div class="attrvalue">';
            }
            if (sizeof($value) > 1) {
                // We hawe several values
                $str .= '<ul>';
                foreach ($value as $listitem) {
                    if ($nameraw === 'jpegPhoto') {
                        $str .= '<li><img src="data:image/jpeg;base64,' . htmlspecialchars($listitem) . '" alt="User photo" /></li>';
                    } else {
                        $str .= '<li>' . htmlspecialchars($listitem) . '</li>';
                    }
                }
                $str .= '</ul>';
            } elseif (isset($value[0])) {
                // We hawe only one value
                if ($nameraw === 'jpegPhoto') {
                    $str .= '<img src="data:image/jpeg;base64,' . htmlspecialchars($value[0]) . '" alt="User photo" />';
                } else {
                    $str .= htmlspecialchars($value[0]);
                }
            }
            // end of if multivalue
            $str .= '</div>';
            if ($isHidden) {
                $str .= '<div class="attrvalue consent_showattribute" id="visible_' . $hiddenId . '">';
                $str .= '... ';
                $str .= '<a class="consent_showattributelink" href="javascript:SimpleSAML_show(\'hidden_' . $hiddenId . '\'); SimpleSAML_hide(\'visible_' . $hiddenId . '\');">';
                $str .= $t->t('{consent:consent:show_attribute}');
                $str .= '</a>';
                $str .= '</div>';
            }
            $str .= '</td></tr>';
        }
        // end else: not child table
    }
    // end foreach
    $str .= isset($attributes) ? '</table>' : '';
    return $str;
}
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:78,代码来源:consentform.php

示例3: array

            if (in_array($country_name, $metaArray['tags'])) {
                $entry['flag'] = SimpleSAML_Module::getModuleURL('metalisting/flags/' . $code . '.png');
                $entry['flag_name'] = $country_name;
                break;
            }
        }
    }
    // Store the data in the result array
    if (array_key_exists($entity_type, $metaentries)) {
        array_push($metaentries[$entity_type], $entry);
    }
}
if (!isset($_GET['output']) || $_GET['output'] !== 'json') {
    $config = SimpleSAML_Configuration::getInstance();
    $t = new SimpleSAML_XHTML_Template($config, 'janus:metalisting.php', 'janus:editentity');
    $t->data['header'] = $t->t('federation_entities_header');
    $t->data['metaentries'] = $metaentries;
    $t->data['workflowstates'] = $workflowstates;
    $t->show();
} else {
    $json = array();
    $type = null;
    if (isset($_GET['type'])) {
        $type = $_GET['type'];
    }
    header('Content-type: application/json');
    header("Content-Disposition: attachment; filename=federation_metadata.json");
    foreach ($metaentries as $entity_type => $entry_set) {
        if (!isset($type) || isset($type) && $type == $entity_type) {
            foreach ($entry_set as $entry) {
                $valid_status = 'bad';
开发者ID:newlongwhitecloudy,项目名称:OpenConext-serviceregistry,代码行数:31,代码来源:metalisting.php

示例4: array

        $formGen = new sspmod_selfregister_XHTML_Form($formFields, 'newUser.php');
        $showFields = sspmod_selfregister_Util::genFieldView($viewAttr);
        $formGen->fieldsToShow($showFields);
        $formGen->setReadOnly('mail');
        $hidden = array('emailconfirmed' => $email, 'token' => $token);
        $formGen->addHiddenData($hidden);
        $formGen->setValues(array('mail' => $email));
        $formGen->setSubmitter('submit_change');
        $formHtml = $formGen->genFormHtml();
        $html = new SimpleSAML_XHTML_Template($config, 'selfregister:step3_register.tpl.php', 'selfregister:selfregister');
        $html->data['formHtml'] = $formHtml;
        $html->show();
    } catch (sspmod_selfregister_Error_UserException $e) {
        // Invalid token
        $terr = new SimpleSAML_XHTML_Template($config, 'selfregister:step1_email.tpl.php', 'selfregister:selfregister');
        $error = $terr->t($e->getMesgId(), $e->getTrVars());
        $terr->data['error'] = htmlspecialchars($error);
        $terr->data['systemName'] = $systemName;
        $terr->show();
    }
} elseif (array_key_exists('sender', $_POST)) {
    try {
        // Add or update user object
        $listValidate = sspmod_selfregister_Util::genFieldView($viewAttr);
        $validator = new sspmod_selfregister_Registration_Validation($formFields, $listValidate);
        $validValues = $validator->validateInput();
        $userInfo = sspmod_selfregister_Util::processInput($validValues, $viewAttr);
        $store = sspmod_selfregister_Storage_UserCatalogue::instantiateStorage();
        $store->addUser($userInfo);
        $html = new SimpleSAML_XHTML_Template($config, 'selfregister:step4_complete.tpl.php', 'selfregister:selfregister');
        $html->data['systemName'] = $systemName;
开发者ID:googlecode-mirror,项目名称:simplesamlphp-labs,代码行数:31,代码来源:newUser.php

示例5: catch

}
$readOnlyFields = $showFields;
$formGen = new sspmod_selfregister_XHTML_Form($formFields, 'delUser.php');
$formGen->fieldsToShow($showFields);
$formGen->setReadOnly($readOnlyFields);
$html = new SimpleSAML_XHTML_Template($config, 'selfregister:deluser.tpl.php', 'selfregister:selfregister');
if (array_key_exists('sender', $_POST)) {
    try {
        // Delete user object
        $store->delUser($attributes[$store->userIdAttr][0]);
        // Now when a User delete himself sucesfully, System log out him.
        // In the future when admin delete a user a msg will be showed
        // $html->data['userMessage'] = 'message_userdel';
        $as->logout(SimpleSAML_Module::getModuleURL('selfregister/index.php?status=deleted'));
    } catch (sspmod_selfregister_Error_UserException $e) {
        // Some user error detected
        $error = $html->t($e->getMesgId(), $e->getTrVars());
        $html->data['error'] = htmlspecialchars($error);
    }
} elseif (array_key_exists('logout', $_GET)) {
    $as->logout(SimpleSAML_Module::getModuleURL('selfregister/index.php'));
} else {
    // The GET access this endpoint
    $values = sspmod_selfregister_Util::filterAsAttributes($attributes, $reviewAttr);
}
$formGen->setValues($values);
$formGen->setSubmitter('submit_delete');
$formHtml = $formGen->genFormHtml();
$html->data['formHtml'] = $formHtml;
$html->data['uid'] = $attributes[$store->userIdAttr][0];
$html->show();
开发者ID:GEANT,项目名称:simplesamlphp-module-selfregister,代码行数:31,代码来源:delUser.php

示例6: array

     $t->data['todo'] = 'loginANSWER';
     $t->data['useSMS'] = false;
     // get a random question
     $random_question = $qaLogin->getRandomQuestion($uid);
     $t->data['random_question'] = array("question_text" => $random_question["question_text"], "question_id" => $random_question["question_id"]);
 } else {
     $t->data['todo'] = 'loginCode';
     if (!$qaLogin->hasMailCode($uid)) {
         $qaLogin->sendMailCode($uid, $email);
     }
 }
 if (isset($_POST['submit'])) {
     // if the form was submitted
     switch ($_POST['submit']) {
         // Next button pushed
         case $t->t('{auth2factor:login:next}'):
             // is this questions ?
             if (isset($_POST['answer'])) {
                 //Ask the user for answer to a randomly selected question
                 if ($prefs['challenge_type'] == 'question') {
                     $loggedIn = $qaLogin->verifyAnswer($uid, $_POST['question_id'], $_POST['answer']);
                     if ($loggedIn) {
                         $state['saml:AuthnContextClassRef'] = $qaLogin->tfa_authencontextclassref;
                         $qaLogin->resetFailedLoginAttempts($uid, 'answer_count');
                         SimpleSAML_Auth_Source::completeAuth($state);
                     } else {
                         $errorCode = 'WRONGANSWER';
                         // only increment if the account is not already locked
                         if (!$qaLogin->isLocked($uid)) {
                             $qaLogin->failedLoginAttempt($uid, 'answer_count', array('name' => $givenName, 'mail' => $email, 'uid' => $uid));
                             if ($failCount == $firstFailCount) {
开发者ID:shoaibali,项目名称:simplesamlphp-module-auth2factor,代码行数:31,代码来源:login.php


注:本文中的SimpleSAML_XHTML_Template::t方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。