예제 #1
0
/**
 * @param Page|AdminPanelView $parentPage
 * @param string $message
 */
function ShowSecurityErrorPage($parentPage, $message)
{
    $urlToRedirect = '';
    if ($parentPage instanceof Page) {
        $linkBuilder = $parentPage->CreateLinkBuilder();
        GetApplication()->GetSuperGlobals()->fillGetParams($linkBuilder);
        $urlToRedirect = '?redirect=' . urlencode($linkBuilder->GetLink());
    }
    $renderer = new ViewAllRenderer($parentPage->GetLocalizerCaptions());
    $errorPage = new CustomErrorPage($parentPage, $parentPage->GetLocalizerCaptions()->GetMessageString('AccessDenied'), $message, sprintf($parentPage->GetLocalizerCaptions()->GetMessageString('AccessDeniedErrorSuggesstions'), 'login.php' . $urlToRedirect));
    echo $renderer->Render($errorPage);
}
예제 #2
0
    public function doAdminPanel($isLoggedIn, LoginView $v, AdminPanelView $av)
    {
        ?>
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title><?php 
        echo \Settings::HOMEPAGE_TITLE;
        ?>
 - Admin Panel</title>
        <link rel="stylesheet" type="text/css" href="css/style.css" />
      </head>
      <body>
            <main>
                <header>
                    <?php 
        if ($isLoggedIn) {
            echo "<h1>Admin Panel</h1>";
        } else {
            echo "<h1>Log in</h1>";
        }
        ?>
                </header>
                <div id="menu">
                      <?php 
        if ($isLoggedIn) {
            echo $av->getMenuHTML();
        }
        ?>
                </div>
                <div id="content">
                      <?php 
        echo $v->response();
        ?>
                      <?php 
        echo $av->response();
        ?>
                </div>
            </main>

            <footer>
                <a href="?">Back to public page</a>
                <p>This site uses cookies to improve user experience. By continuing to browse the site you are agreeing to our use of cookies.</p>
            </footer>
       </body>
    </html>
    <?php 
    }