function local_generateFooter($fullscreen)
{
    $pageFooter = new CView('layout.htmlpage.footer', ['fullscreen' => $fullscreen, 'user' => ['alias' => CWebUser::$data['alias'], 'debug_mode' => CWebUser::$data['debug_mode']]]);
    echo $pageFooter->getOutput();
}
    if (CSession::keyExists('messages')) {
        $messages = CSession::getValue('messages');
        CSession::unsetValue(['messages']);
    }
    if (CSession::keyExists('messageOk')) {
        $message_good = true;
        $message_ok = CSession::getValue('messageOk');
    } else {
        $message_good = false;
        $message_error = CSession::getValue('messageError');
    }
    CSession::unsetValue(['messageOk', 'messageError']);
}
if (!defined('ZBX_PAGE_NO_MENU')) {
    $pageMenu = new CView('layout.htmlpage.menu', ['server_name' => isset($ZBX_SERVER_NAME) ? $ZBX_SERVER_NAME : '', 'menu' => ['main_menu' => $main_menu, 'sub_menus' => $sub_menus, 'selected' => $page['menu']], 'user' => ['is_guest' => CWebUser::isGuest(), 'alias' => CWebUser::$data['alias'], 'name' => CWebUser::$data['name'], 'surname' => CWebUser::$data['surname']]]);
    echo $pageMenu->getOutput();
}
if ($page['type'] == PAGE_TYPE_HTML) {
    echo '<div class="' . ZBX_STYLE_ARTICLE . '">';
}
// unset multiple variables
unset($table, $top_page_row, $menu_table, $main_menu_row, $sub_menu_table, $sub_menu_rows);
if ($page['type'] == PAGE_TYPE_HTML && $showGuiMessaging) {
    zbx_add_post_js('initMessages({});');
}
// if a user logs in after several unsuccessful attempts, display a warning
if ($failedAttempts = CProfile::get('web.login.attempt.failed', 0)) {
    $attempip = CProfile::get('web.login.attempt.ip', '');
    $attempdate = CProfile::get('web.login.attempt.clock', 0);
    $error_msg = _n('%4$s failed login attempt logged. Last failed attempt was from %1$s on %2$s at %3$s.', '%4$s failed login attempts logged. Last failed attempt was from %1$s on %2$s at %3$s.', $attempip, zbx_date2str(DATE_FORMAT, $attempdate), zbx_date2str(TIME_FORMAT, $attempdate), $failedAttempts);
    error($error_msg);
Exemple #3
0
 /**
  * Process request and generate response. Main entry for all processing.
  */
 private function processRequest()
 {
     $router = new CRouter(getRequest('action'));
     $controller = $router->getController();
     $controller = new $controller();
     $controller->setAction($router->getAction());
     $response = $controller->run();
     // Controller returned data
     if ($response instanceof CControllerResponseData) {
         // if no view defined we pass data directly to layout
         if ($router->getView() === null) {
             $layout = new CView($router->getLayout(), $response->getData());
             echo $layout->getOutput();
         } else {
             $view = new CView($router->getView(), $response->getData());
             $data['page']['title'] = $response->getTitle();
             $data['controller']['action'] = $router->getAction();
             $data['main_block'] = $view->getOutput();
             $data['fullscreen'] = isset($_REQUEST['fullscreen']) && $_REQUEST['fullscreen'] == 1 ? 1 : 0;
             $data['javascript']['files'] = $view->getAddedJS();
             $data['javascript']['pre'] = $view->getIncludedJS();
             $data['javascript']['post'] = $view->getPostJS();
             $layout = new CView($router->getLayout(), $data);
             echo $layout->getOutput();
         }
     } else {
         if ($response instanceof CControllerResponseRedirect) {
             header('Content-Type: text/html; charset=UTF-8');
             if ($response->getMessageOk() !== null) {
                 CSession::setValue('messageOk', $response->getMessageOk());
             }
             if ($response->getMessageError() !== null) {
                 CSession::setValue('messageError', $response->getMessageError());
             }
             global $ZBX_MESSAGES;
             if (isset($ZBX_MESSAGES)) {
                 CSession::setValue('messages', $ZBX_MESSAGES);
             }
             if ($response->getFormData() !== null) {
                 CSession::setValue('formData', $response->getFormData());
             }
             redirect($response->getLocation());
         } else {
             if ($response instanceof CControllerResponseFatal) {
                 header('Content-Type: text/html; charset=UTF-8');
                 $response->addMessage('Controller: ' . $router->getAction());
                 ksort($_REQUEST);
                 foreach ($_REQUEST as $key => $value) {
                     // do not output SID
                     if ($key != 'sid') {
                         $response->addMessage($key . ': ' . $value);
                     }
                 }
                 CSession::setValue('messages', $response->getMessages());
                 redirect('zabbix.php?action=system.warning');
             }
         }
     }
 }