Example #1
0
    $controller = new LoginController();
    $controller->login();
});
$app->get('/inbox', function () {
    UserHelper::requireProfile();
    $controller = new MailController();
    $controller->inbox();
});
$app->get('/inbox/:id', function ($id) {
    UserHelper::requireProfile();
    $controller = new MailController();
    $controller->inbox($id);
});
$app->get('/help', function () {
    //UserHelper::requireProfile();
    $controller = new HelpController();
    $controller->show();
});
$app->get('/search', function () {
    UserHelper::requireProfile();
    $controller = new SearchController();
    $controller->index();
});
$app->post('/inbox', function () {
    fAuthorization::requireLoggedIn();
    $controller = new MailController();
    $controller->create();
});
$app->delete('/inbox/:id', function ($id) {
    fAuthorization::requireLoggedIn();
    $controller = new MailController();
Example #2
0
<?php

/*
Author Logan Rasmussen
Date March 28, 2016
File help.php
*/
require_once "Controllers/HelpController.php";
$controller = new HelpController();
$controller->start();
Example #3
0
        if ($_GET[KEY_PATH] == "manager") {
            include CONTROLLER_PATH . "manager.php";
            // path = manager
            if ($_GET[KEY_TARGET] == "noticeboard") {
                ManagerController::noticeboard();
            } else {
                if ($_GET[KEY_TARGET] == "loginrecord") {
                    ManagerController::loginrecord();
                } else {
                    if ($_GET[KEY_TARGET] == "permission") {
                        ManagerController::permission();
                    } else {
                        if ($_GET[KEY_TARGET] == "googleanalytics") {
                            ManagerController::googleAnalytics();
                        }
                    }
                }
            }
        } else {
            if ($_GET[KEY_PATH] == "help") {
                include CONTROLLER_PATH . "help.php";
                HelpController::show();
            } else {
                if ($_GET[KEY_PATH] == "search") {
                    include CONTROLLER_PATH . "search.php";
                    SearchController::index();
                }
            }
        }
    }
}
Example #4
0
{
    public function ActionDefault()
    {
        $template = new Template();
        switch ($this->action) {
            case 'guide':
                $template->title = 'Usenet Guide';
                $template->body = new Template('help_guide');
                break;
            case 'faq':
                $template->title = 'FAQ';
                $template->body = new Template('help_faq');
                break;
            case 'contact':
                $template->title = 'Contact';
                $template->body = new Template('help_contact');
                break;
            default:
                header('Location: ' . static::$config['url']['base']);
                exit;
        }
        $template->title .= ' :: ';
        $template->rss = static::$config['url']['rss'];
        $template->searchbox = new Template('searchbox');
        $template->menu = new Template('menu');
        $template->Display('layout');
    }
}
// Display
$controller = new HelpController();
echo $controller->Run();
<?php

require __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
$request = Request::createFromGlobals();
$config = Config::getConfig();
$arguments = explode(' ', $request->get('text'));
$command = array_shift($arguments);
switch (strtolower($command)) {
    case 'account':
        $controller = new AccountController();
        break;
    case 'email':
        $controller = new EmailController();
        break;
    case 'help':
    default:
        $controller = new HelpController();
        break;
}
$controller->setSlashCommand($request->get('command'))->setRequest($request)->setConfig($config)->setCommand($command)->setArguments($arguments)->checkCredentials();
$response = $controller->getResponse();
$response->send();
Example #6
0
 /** Display the requested page. */
 function displayPage($webPage)
 {
     setcookie("last-page", full_url($_SERVER));
     if (isset($_SESSION["message"])) {
         $message = $_SESSION["message"];
         $this->tpl->assign('message', $message);
         unset($_SESSION["message"]);
     }
     try {
         if (isset($this->pdo)) {
             $sth = $this->pdo->prepare("SELECT COUNT(alerts.id) AS c FROM alerts WHERE resolved = 0");
             $sth->execute();
             $countAlerts = $sth->fetch(PDO::FETCH_ASSOC);
             $countAlerts = $countAlerts["c"];
             $this->tpl->assign('countAlerts', $countAlerts);
         }
     } catch (Exception $e) {
         Log::getLogger()->write(Log::LOG_ERROR, "Unable to request DB", $e);
         $this->tpl->assign('countAlerts', 0);
     }
     try {
         switch ($webPage) {
             case CONTROLLER_DASHBOARD:
                 $c = new DashboardController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_ADMIN:
                 $c = new AdminController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_PROFILE:
                 $c = new ProfileController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_HELP:
                 $c = new HelpController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_LOGIN:
                 $c = new LoginController($this->pdo);
                 $c->buildTemplate($this->tpl);
                 break;
             case CONTROLLER_DEFAULT:
             default:
                 $this->tpl->display('controller_blank.tpl');
                 break;
         }
     } catch (SecurityAccessException $sae) {
         if ($this->tpl->getTemplateVars('message') == null) {
             $_SESSION["message"] = array("type" => "danger", "title" => "Accès interdit", "descr" => "Cette page est protégée. Veuillez vous connecter avec un compte ayant accès à cette page.");
             $this->tpl->assign('message', $_SESSION["message"]);
             unset($_SESSION["message"]);
         }
         // A Security Access Exception occurs when the user cannot see the asked page.
         // So in this case let's redirect to login page.
         $c = new LoginController($this->pdo);
         $c->buildTemplate($this->tpl);
     } catch (SecurityException $se) {
         // A Security Exception is more generic so display a message.
         Log::getLogger()->write(Log::LOG_ALERT, "Security Exception dropped on dispatcher", $se);
         $_SESSION["message"] = array("type" => "danger", "title" => "Erreur", "descr" => $se->getMessage());
         $this->tpl->assign('message', $_SESSION["message"]);
         unset($_SESSION["message"]);
         $this->tpl->display('controller_error.tpl');
     } catch (Exception $e) {
         Log::getLogger()->write(Log::LOG_ERROR, "Unknown Exception dropped on dispatcher", $e);
         // A very generic exception.
         $_SESSION["message"] = array("type" => "danger", "title" => "Erreur", "descr" => $e->getMessage());
         $this->tpl->assign('message', $_SESSION["message"]);
         unset($_SESSION["message"]);
         $this->tpl->display('controller_error.tpl');
     }
 }
 public function testGetHelp()
 {
     $_SERVER['SERVER_NAME'] = 'bob.localhost.com';
     $dir = FileUtils::join(NIMBLE_ROOT, 'app', 'view', 'help', 'markdown');
     foreach (HelpController::get_markdown_files($dir) as $help) {
         $name = substr(basename($help), 0, -9);
         $this->get('show', array(), array('name' => $name));
         $this->responseIncludes(ucwords(Inflector::humanize($name)));
         $this->controller = new HelpController();
     }
 }