コード例 #1
0
ファイル: routes.php プロジェクト: hyttijan/MyImgur
<?php

$routes->get('/', function () {
    $content = ImageController::getMostRecentImages(0);
    View::make("home.html", $content);
});
$routes->post('/rate', function () {
    $parameters = $_POST;
    ImageController::rate($parameters);
});
$routes->get('/home', function () {
    $content = ImageController::getMostRecentImages(0);
    View::make("home.html", $content);
});
$routes->get('/home-:id', function ($id) {
    $content = ImageController::getMostRecentImages($id);
    View::make("home.html", $content);
});
$routes->get('/profile-:id', function ($id) {
    $content = UserController::getProfile($id);
    $user = $content["user"];
    if ($user->username == null) {
        $content["error"] = "User doesn't exist";
        BaseController::set_flash($content);
        Redirect::to("/");
    }
    View::make("profile.html", $content);
});
$routes->get('/recent', function () {
    $content = ImageController::getMostRecentImages(0);
    View::make("home.html", $content);