public function render()
 {
     // TODO Do not use global
     global $microblogTemplates, $pageTitle, $pageAuthor, $post;
     $postView = new PostView();
     $activitiesView = new ActivitiesView();
     $profileView = new ProfileView();
     $followView = new FollowView();
     $tpl = new \rubisco\text\SimpleTemplate($microblogTemplates);
     $tpl->pageAuthor = $pageAuthor;
     $tpl->pageTitle = $pageTitle;
     $tpl->showLog = '';
     $tpl->login = "******";
     $tpl->infoMessage = $this->m->getLastInfoMessagesAsHTML();
     $tpl->postView = '';
     $tpl->activities = $activitiesView->html();
     $tpl->profile = $profileView->html();
     $tpl->follow = $followView->html();
     if ($this->m->isLogin()) {
         $tpl->showLog = '<li><a href="?showLog=1">Show Log</a></li>';
         $tpl->login = "******";
         $tpl->postView = $postView->html($post['message'], $post['to']);
     }
     $this->m->clearLastInfoMessages();
     $content = $tpl->render('head') . $tpl->render('main') . $tpl->render('foot');
     header('Content-Type: text/html; charset=utf-8');
     header('Content-Length: ' . strlen($content));
     echo $content;
 }
    public function render()
    {
        // TODO Do not use global
        global $microblogTemplates, $pageTitle, $pageAuthor, $post;
        $content = '';
        $tpl = new \rubisco\text\SimpleTemplate($microblogTemplates);
        $tpl->pageAuthor = $pageAuthor;
        $tpl->pageTitle = $pageTitle;
        $tpl->showLog = '';
        $tpl->login = '';
        $content = $tpl->render('head');
        $content .= $this->m->getLastInfoMessagesAsHTML();
        // TODO Dont print if already in lastInfoMessage
        if (!isset($_COOKIE['PHPSESSID'])) {
            $content .= "<p class='note'>Note: For login cookies must be enabled.</p>\n";
        }
        $content .= <<<HTML
<form action="" method="post">
  <p>
    <label for="name">Username</label>
    <input type="text" id="username" name="username" size="20" maxlength="20" value="" />
    <br />

    <label for="name">Password</label>
    <input type="password" id="password" name="password" size="20" maxlength="256" value="" />
    <br />

    <input type="submit" name="loginCancel" value="Cancel" />
    <input type="submit" name="login" value="Login" />
  </p>
</form>
HTML;
        $content .= $tpl->render('foot');
        $this->m->clearLastInfoMessages();
        header('Content-Type: text/html; charset=utf-8');
        header('Content-Length: ' . strlen($content));
        echo $content;
    }
Example #3
0
            }
            break;
        case 'logout':
            $_SESSION['login'] = false;
            header("Location: http://{$m->cfg->servername}{$m->cfg->path}");
            break;
        case 'loginCancel':
            $_SESSION['login'] = false;
            header("Location: http://{$m->cfg->servername}{$m->cfg->path}");
            break;
        case 'showLog':
            $logger->debug("Show log: '{$post['logLevel']}' Size: '{$post['logSize']}'");
            $logfilename = 'logs/log4php.log';
            // TODO Move to config
            $content = '';
            $tpl = new \rubisco\text\SimpleTemplate($microblogTemplates);
            $tpl->pageAuthor = $pageAuthor;
            $tpl->pageTitle = $pageTitle;
            $tpl->showLog = '';
            $tpl->login = '';
            $content = $tpl->render('head');
            // Check
            if (!$m->isLogin()) {
                throw new \Exception('SECURITY: No login for show login!');
            }
            $content .= <<<HTML
<form action="">
    <p>
    <!--
    <input type='checkbox' name='logLevel[]' value='info'  checked="checked" /> Info
    <input type='checkbox' name='logLevel[]' value='warn'  checked="checked" /> Warn