function trust_render($info) { $current_user = getLoggedInUser(); $lnk = link_render($current_user); $trust_root = htmlspecialchars($info->trust_root); $trust_url = buildURL('trust', true); $form = sprintf(trust_form_pat, $lnk, $trust_root, $trust_url); return page_render($form, $current_user, 'Trust This Site'); }
function sites_render($sites) { if ($sites) { $rows = siteList_render($sites); $form = sprintf(sites_form, buildURL('sites'), $rows); $body = $pre . $form; } else { $body = sprintf(sites_empty_message, link_render(buildURL(''), 'Return home')); } return page_render($body, getLoggedInUser(), 'Remembered Sites'); }
function trust_render($info) { $current_user = getLoggedInUser(); $lnk = link_render(idURL($current_user)); $trust_root = htmlspecialchars($info->trust_root); $trust_url = buildURL('trust', true); if ($info->idSelect()) { $prompt = id_select_pat; } else { $prompt = sprintf(normal_pat, $lnk, $trust_root); } $form = sprintf(trust_form_pat, $trust_url, $prompt); return page_render($form, $current_user, 'Trust This Site'); }
function login_render($errors = null, $input = null, $needed = null) { $current_user = getLoggedInUser(); if ($input === null) { $input = $current_user; } if ($needed) { $errors[] = sprintf(login_needed_pat, link_render($needed)); } $esc_input = htmlspecialchars($input, ENT_QUOTES); $login_url = buildURL('login', true); $body = sprintf(login_form_pat, $login_url, $esc_input); if ($errors) { $body = loginError_render($errors) . $body; } return page_render($body, $current_user, 'Log In', null, true); }
function navigation_render($msg, $items) { $what = link_render(buildURL(), 'PHP OpenID Server'); if ($msg) { $what .= ' — ' . $msg; } if ($items) { $s = '<p>' . $what . '</p><ul class="bottom">'; foreach ($items as $action => $text) { $url = buildURL($action); $s .= sprintf('<li>%s</li>', link_render($url, $text)); } $s .= '</ul>'; } else { $s = '<p class="bottom">' . $what . '</p>'; } return sprintf('<div class="navigation">%s</div>', $s); }
/** * Render an HTML page */ function page_render($body, $user, $title, $h1 = null, $login = false) { $h1 = $h1 ? $h1 : $title; if ($user) { $msg = sprintf(logged_in_pat, link_render($user)); $nav = array('logout' => 'Log Out', 'sites' => 'Remembered Sites'); $navigation = navigation_render($msg, $nav); } else { if (!$login) { $msg = link_render(buildURL('login'), 'Log In'); $navigation = navigation_render($msg, array()); } else { $navigation = ''; } } $style = getStyle(); $text = sprintf(page_template, $title, $style, $navigation, $h1, $body); // No special headers here $headers = array(); return array($headers, $text); }
function trust_render($info) { $current_user = getLoggedInUser(); $lnk = link_render(idURL($current_user)); $trust_root = htmlspecialchars($info->trust_root); // $trust_url = buildURL('trust', true); $trust_url = "https://openid4.me/index.php/trust"; // if ($info->idSelect()) { // $prompt = id_select_pat; // $prompt = sprintf(id_select_pat, $trust_root); // } else { // $prompt = sprintf(normal_pat, $lnk, $trust_root); // $prompt = sprintf(normal_pat, $trust_root); // } $prompt = sprintf(id_select_pat, $trust_root); //print "<pre>"; //print_r($info); //print "</pre>"; $form = sprintf(trust_form_pat, $trust_url, $prompt); // return page_render($form, $current_user, 'Trust This Site'); return page_render($form, $current_user, 'openid4.me - Confirm Login Request and Select your WebID'); }