Beispiel #1
0
 public static function checkLoggedIn()
 {
     if (self::getCurrent() instanceof User) {
         return true;
     } else {
         TigerApp::getSlimApp()->response()->redirect("/login");
     }
 }
Beispiel #2
0
 public function testTigerSlimInvoke()
 {
     $body = implode("\n\n", $this->faker->paragraphs(5));
     TigerApp::run();
     $tigerApp = new TigerApp(__DIR__);
     $tigerSlim = $tigerApp->getSlimApp();
     $tigerSlim->get("/tigerslimtest", function () use($tigerSlim, $body) {
         $tigerSlim->response()->body($body);
     });
     $requestParams = array('PATH_INFO' => "/tigerslimtest", 'REQUEST_METHOD' => "GET");
     Environment::mock($requestParams);
     $response = $tigerSlim->invoke();
     $this->assertTrue($response instanceof Response);
     $this->assertEquals(200, $response->getStatus());
     $this->assertEquals($body, $response->getBody());
     $this->assertEquals(strlen($body), $response->getLength());
 }
Beispiel #3
0
 public function __construct()
 {
     $this->slim = TigerApp::getSlimApp();
 }
Beispiel #4
0
<?php

/** @var $app \Slim\Slim */
use SampleApp\Controllers;
# Index page.
\TigerKit\TigerApp::getSlimApp()->get('/', '\\SampleApp\\Controllers\\IndexController:index');
# User Auth
\TigerKit\TigerApp::getSlimApp()->get('/login', '\\SampleApp\\Controllers\\UserController:showLogin');
\TigerKit\TigerApp::getSlimApp()->post('/login', '\\SampleApp\\Controllers\\UserController:doLogin');
\TigerKit\TigerApp::getSlimApp()->get('/register', '\\SampleApp\\Controllers\\UserController:showRegister');
\TigerKit\TigerApp::getSlimApp()->post('/register', '\\SampleApp\\Controllers\\UserController:doRegister');
\TigerKit\TigerApp::getSlimApp()->get('/logout', '\\SampleApp\\Controllers\\UserController:logout');
# Dashboard
\TigerKit\TigerApp::getSlimApp()->get('/dashboard', '\\SampleApp\\Controllers\\DashboardController:dashboard');
# Gallery
\TigerKit\TigerApp::getSlimApp()->get('/gallery', '\\SampleApp\\Controllers\\GalleryController:showList');
\TigerKit\TigerApp::getSlimApp()->get('/gallery/upload', '\\SampleApp\\Controllers\\GalleryController:showUpload');
\TigerKit\TigerApp::getSlimApp()->post('/gallery/upload', '\\SampleApp\\Controllers\\GalleryController:doUpload');
# Boards
\TigerKit\TigerApp::getSlimApp()->get('/r', '\\SampleApp\\Controllers\\BoardController:showHomepage');
\TigerKit\TigerApp::getSlimApp()->get('/r/all', '\\SampleApp\\Controllers\\BoardController:showAll');
\TigerKit\TigerApp::getSlimApp()->get('/r/new', '\\SampleApp\\Controllers\\BoardController:showNew');
\TigerKit\TigerApp::getSlimApp()->get('/r/list', '\\SampleApp\\Controllers\\BoardController:listBoards');
\TigerKit\TigerApp::getSlimApp()->get('/r/:board', '\\SampleApp\\Controllers\\BoardController:showBoard');
\TigerKit\TigerApp::getSlimApp()->get('/r/:board/:thread', '\\SampleApp\\Controllers\\BoardController:showThread');