function displayLogin() { global $smarty, $message, $config, $ssl, $error_collector, $error_collector_mailto; $lang = session::global_get('lang'); error_reporting(E_ALL | E_STRICT); /* Fill template with required values */ $username = ''; if (isset($_POST['username'])) { $username = trim($_POST['username']); } $smarty->assign('date', gmdate("D, d M Y H:i:s")); $smarty->assign('username', $username); $smarty->assign('personal_img', "geticon.php?context=types&icon=user&size=48"); $smarty->assign('password_img', "geticon.php?context=status&icon=dialog-password&size=48"); $smarty->assign('directory_img', "geticon.php?context=places&icon=network-server&size=48"); $smarty->append('css_files', get_template_path('login.css')); /* Some error to display? */ if (!isset($message)) { $message = ""; } $smarty->assign("message", $message); /* Displasy SSL mode warning? */ if ($ssl != "" && $config->get_cfg_value('warnSSL') == 'TRUE') { $smarty->assign("ssl", _("Warning") . ": <a style=\"color:red;\" href=\"{$ssl}\">" . _("Session is not encrypted!") . "</a>"); } else { $smarty->assign("ssl", ""); } if (!$config->check_session_lifetime()) { $smarty->assign("lifetime", _("Warning") . ": " . _("The session lifetime configured in your fusiondirectory.conf will be overridden by php.ini settings.")); } else { $smarty->assign("lifetime", ""); } /* Generate server list */ $servers = array(); if (isset($_POST['server'])) { $selected = $_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", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector) . "</div>"); } else { $smarty->assign("php_errors", ""); } $smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->assign("usePrototype", "false"); $smarty->assign("date", date("l, dS F Y H:i:s O")); $smarty->assign("lang", preg_replace('/_.*$/', '', $lang)); $smarty->assign("rtl", language_is_rtl($lang)); $smarty->display(get_template_path('headers.tpl')); $smarty->assign("version", FD_VERSION); $smarty->display(get_template_path('login.tpl')); exit; }
} /* Redirect on password back event */ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['password_back'])) { header("Location: main.php"); exit; } /* Load department list when plugin has changed. That is some kind of compromise between speed and beeing up to date */ if (isset($_GET['reset'])) { set_object_info(); } /* show web frontend */ $smarty->assign("date", date("l, dS F Y H:i:s O")); $lang = session::global_get('lang'); $smarty->assign("lang", preg_replace('/_.*$/', '', $lang)); $smarty->assign("rtl", language_is_rtl($lang)); $smarty->assign("must", '<span class="must">*</span>'); if (isset($plug)) { $plug = "?plug={$plug}"; } else { $plug = ""; } if ($ui->ignore_acl_for_current_user()) { $smarty->assign('username', '<div style="color:#FF0000;">' . _('User ACL checks disabled') . '</div> ' . $ui->uid); } else { $smarty->assign('username', $ui->uid); } $smarty->assign("menu", $plist->menu); $smarty->assign("plug", "{$plug}"); $smarty->assign("usePrototype", "false"); /* React on clicks */