public static function logout() { $_SESSION['user'] = null; session_destroy(); $content["success"] = "Logged out"; BaseController::set_flash($content); Redirect::to("/"); }
public static function make($file, $content = array()) { $twig = self::get_twig(); if (BaseController::get_flash() != null) { $content['flash'] = BaseController::get_flash(); BaseController::set_flash(null); } $content['user_logged_in'] = BaseController::get_user_logged_in(); echo $twig->render($file, $content); }
View::make("image.html", $content); }); $routes->get('/uploadImage', function () { View::make('uploadImage.html'); }); $routes->post('/comment', function () { $params = $_POST; $content = CommentController::add($params); BaseController::set_flash($content); var_dump($params); Redirect::to("/image-" . $params["image"]); }); $routes->post('/uploadImage', function () use($routes) { $params = $_POST; $fileparams = $_FILES; $content = ImageController::uploadImage($params, $fileparams); BaseController::set_flash($content); if (!array_key_exists("errors", $content)) { Redirect::to("/"); } else { Redirect::to("/uploadImage"); } }); $routes->post('/deleteImage', function () { $params = $_POST; $array = array(); $array[] = $params["imageId"]; $content = ImageController::deleteImages($array); BaseController::set_flash($content); Redirect::to("/"); });