コード例 #1
0
ファイル: routes.php プロジェクト: hyttijan/MyImgur
    $content = ImageController::getUnratedImages($id);
    View::make("home.html", $content);
});
$routes->get('/popular-:id', function ($id) {
    $content = ImageController::getMostPopularImages($id);
    View::make("home.html", $content);
});
$routes->get('/search?:params', function () use($routes) {
    $params = $routes->request()->get();
    $searchword = $params["searchword"];
    $content = array();
    if (array_key_exists('id', $params)) {
        $id = $params["id"];
        $content = ImageController::getSearchResults($searchword, $id);
    } else {
        $content = ImageController::getSearchResults($searchword, 0);
    }
    View::make("home.html", $content);
});
$routes->get('/register', function () {
    View::make('register.html');
});
$routes->post('/register', function () {
    $params = $_POST;
    $content = UserController::register($params);
    BaseController::set_flash($content);
    Redirect::to("/");
});
$routes->get('/logout', function () {
    UserController::logout();
});