示例#1
0
$smarty->assign("date", date("l, dS F Y H:i:s O"));
$header = "<!-- headers.tpl-->" . $smarty->fetch(get_template_path('setup_headers.tpl'));
/* Set focus to the error button if we've an error message */
$focus = "";
if (session::is_set('errors') && session::get('errors') != "") {
    $focus = '<script language="JavaScript" type="text/javascript">';
    $focus .= 'document.forms[0].error_accept.focus();';
    $focus .= '</script>';
}
$focus = '<script language="JavaScript" type="text/javascript">';
$focus .= 'next_msg_dialog();';
$focus .= '</script>';
/* show web frontend */
$setup = session::global_get('setup');
$smarty->assign("contents", $display);
$smarty->assign("navigation", $setup->get_navigation_html());
$smarty->assign("header", $setup->get_header_html());
$smarty->assign("bottom", $focus . $setup->get_bottom_html());
$smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
if ($error_collector != "") {
    $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>");
} else {
    $smarty->assign("php_errors", "");
}
if (function_exists("get_gosa_version")) {
    $smarty->assign("version", get_gosa_version());
} else {
    $smarty->assign("version", "");
}
echo $header . $smarty->fetch("../setup/setup_frame.tpl");
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
示例#2
0
/**
 * Display the login page and exit().
 *
 */
function displayLogin()
{
    global $smarty, $message, $config, $ssl, $error_collector, $BASE_DIR;
    error_reporting(E_ALL | E_STRICT);
    /* Check theme compatibility */
    $theme = $config->get_cfg_value("core", 'theme');
    if (file_exists("{$BASE_DIR}/ihtml/themes/{$theme}/blacklist")) {
        $blocks = file("{$BASE_DIR}/ihtml/themes/{$theme}/blacklist");
        foreach ($blocks as $block) {
            if (preg_match('/' . preg_quote($block) . '/', $_SERVER['HTTP_USER_AGENT'])) {
                die(sprintf(_("Your browser (%s) is blacklisted for the current theme!"), $block));
            }
        }
    }
    /* Fill template with required values */
    $username = "";
    if (isset($_POST["username"])) {
        $username = get_post("username");
    }
    $smarty->assign("title", "GOsa - " . $_SERVER['SERVER_NAME']);
    $smarty->assign("logo", image(get_template_path("images/logo.png")));
    $smarty->assign('date', gmdate("D, d M Y H:i:s"));
    $smarty->assign('username', $username);
    $smarty->assign('personal_img', get_template_path('images/login-head.png'));
    $smarty->assign('password_img', get_template_path('images/password.png'));
    $smarty->assign('directory_img', get_template_path('images/ldapserver.png'));
    /* Some error to display? */
    if (!isset($message)) {
        $message = "";
    }
    $smarty->assign("message", $message);
    /* Displasy SSL mode warning? */
    if ($ssl != "" && $config->get_cfg_value("core", 'warnSSL') == 'true') {
        $smarty->assign("ssl", sprintf(_("This session is not encrypted. Click %s to enter an encrypted session."), "<a href=\"{$ssl}\">" . bold(_("here")) . "</a>"));
    } else {
        $smarty->assign("ssl", "");
    }
    if (!$config->check_session_lifetime()) {
        $smarty->assign("lifetime", _("The configured session lifetime will be overridden by php.ini settings!"));
    } else {
        $smarty->assign("lifetime", "");
    }
    /* Generate server list */
    $servers = array();
    if (isset($_POST['server'])) {
        $selected = get_post('server');
    } else {
        $selected = $config->data['MAIN']['DEFAULT'];
    }
    foreach ($config->data['LOCATIONS'] as $key => $ignored) {
        $servers[$key] = $key;
    }
    $smarty->assign("server_options", $servers);
    $smarty->assign("server_id", $selected);
    /* show login screen */
    $smarty->assign("PHPSESSID", session_id());
    if (session::is_set('errors')) {
        $smarty->assign("errors", session::get('errors'));
    }
    if ($error_collector != "") {
        $smarty->assign("php_errors", $error_collector . "</div>");
    } else {
        $smarty->assign("php_errors", "");
    }
    $smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
    $smarty->display(get_template_path('headers.tpl'));
    $smarty->assign("version", get_gosa_version());
    $smarty->display(get_template_path('login.tpl'));
    exit;
}