/** * Parses the information in html format * * @return String String with Html Code * @author Lars Michelsen <*****@*****.**> */ public function parse() { global $LOGIN_MSG, $_MAINCFG; // Initialize template system $TMPL = new FrontendTemplateSystem(); $TMPLSYS = $TMPL->getTmplSys(); $target = CoreRequestHandler::getRequestUri(''); // Add the language to the target url when the user requested a specific language if (isset($_GET['lang']) && $_GET['lang'] != '' && strpos($target, 'lang=') === false) { if (strpos($target, '?') === false) { $target .= '?lang=' . $_GET['lang']; } else { $target .= '&lang=' . $_GET['lang']; } } $aData = array('generalProperties' => $_MAINCFG->parseGeneralProperties(), 'locales' => json_encode(array()), 'pageTitle' => cfg('internal', 'title') . ' › Log In', 'htmlBase' => cfg('paths', 'htmlbase'), 'htmlJs' => cfg('paths', 'htmljs'), 'htmlCss' => cfg('paths', 'htmlcss'), 'formTarget' => $target, 'htmlTemplates' => path('html', 'global', 'templates'), 'htmlImages' => cfg('paths', 'htmlimages'), 'maxPasswordLength' => AUTH_MAX_PASSWORD_LENGTH, 'maxUsernameLength' => AUTH_MAX_USERNAME_LENGTH, 'langName' => l('Name'), 'langPassword' => l('Password'), 'langLogin' => l('Login'), 'langTitleCookiesDisabled' => l('Cookies disabled'), 'langTextCookiesDisabled' => l('NagVis is unable to set a cookie in your browser. Please enable cookies for at least the NagVis host.'), 'loginMsg' => isset($LOGIN_MSG) && $LOGIN_MSG !== null ? $LOGIN_MSG->msg : ''); // Build page based on the template file and the data array return $TMPLSYS->get($TMPL->getTmplFile(cfg('defaults', 'view_template'), 'login'), $aData); }
public function handleAction() { global $AUTH; $sReturn = ''; if ($this->offersAction($this->sAction)) { switch ($this->sAction) { case 'view': // Check if user is already authenticated if (!$AUTH->isAuthenticated()) { $VIEW = new NagVisLoginView($this->CORE); $sReturn = $VIEW->parse(); } else { // When the user is already authenticated redirect to start page (overview) Header('Location:' . CoreRequestHandler::getRequestUri(cfg('paths', 'htmlbase'))); } break; } } return $sReturn; }