<?php use controllers\BlogsController; use controllers\UsersController; use controllers\PostsController; $user = new UsersController(); $user->render(); $user_error = $user->getError(); $me = $user->getMe(); $blog = new BlogsController(); $blog->render(); $blog_error = $blog->getError(); $blogs = $blog->getBlogs(); $edit_blog = $blog->getBlog(); $post = new PostsController(); $post->render(); $post_error = $post->getError(); $posts = $post->getPosts(); $one = $post->getPost(); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="description" content="blog description" /> <title>blog title</title> <link media="all" type="text/css" rel="stylesheet" href="media/css/bootstrap.min.css" /> <link media="all" type="text/css" rel="stylesheet" href="media/css/bootstrap-theme.min.css" /> <link media="all" type="text/css" rel="stylesheet" href="media/css/mui.min.css" /> <link media="all" type="text/css" rel="stylesheet" href="media/css/style.css" /> <script src="media/js/jquery-2.1.4.min.js"></script>
$categories = $o->get(); } if (isset($_POST['title']) && isset($_POST['content']) && isset($_POST['post_id']) && isset($_POST['send']) && $_POST['send'] == 'comment') { $o = new CommentsController(); echo $o->create($_POST['post_id'], $_POST['content'], $_POST['title'], $_POST["note"]); } if (isset($_POST['vote']) && isset($_POST['comment_id']) && isset($_POST['send']) && $_POST['send'] == 'vote') { $o = new CommentsController(); if ($_POST['vote'] === 'plus') { echo $o->setPlusComment($_POST['comment_id']); } elseif ($_POST['vote'] === 'minus') { echo $o->setMinusComment($_POST['comment_id']); } } if (isset($_GET['connected'])) { $connected = UsersController::isConnected(); if ($connected) { echo json_encode(array('connected' => true, 'id' => $_SESSION['id'], 'token' => $_SESSION['token'], 'name' => $_SESSION['name'])); } else { echo json_encode(array('connected' => false)); } } if (isset($post)) { echo $post; } if (isset($blog)) { echo $blog; } if (isset($comments)) { echo $comments; }
use controllers\UsersController; if (isset($_GET['logout'])) { if (isset($_SESSION['token']) && $_SESSION['token'] == $_GET['token']) { session_destroy(); header('Location:./'); } } if (isset($_POST['register'])) { $o = new UsersController(); if ($o->create($_POST["username"], $_POST["lastname"], $_POST["firstname"], $_POST["email"], $_POST["password"], $_POST["confirm_password"], $_POST["email"])) { $o->connection($_POST['username'], $_POST['password']); } $error_sign_up = $o->getError(); } if (isset($_POST['connection'])) { $o = new UsersController(); $o->connection($_POST['log'], $_POST['password']); $error_sign_in = $o->getError(); header('Location: ./?page=panel'); } $connected = UsersController::isConnected(); if (isset($_GET["page"])) { switch ($_GET["page"]) { case 'connection': include './views/menu.php'; include './views/connect.php'; break; case 'home': include './views/menu.php'; include './views/home.php'; break;
<?php use controllers\BlogsController; use controllers\UsersController; use controllers\PostsController; $user = new UsersController(); $user->render(); $user_error = $user->getError(); $me = $user->getMe(); $blog = new BlogsController(); $blog->render(); $blog_error = $blog->getError(); $blogs = $blog->getBlogs(); $edit_blog = $blog->getBlog(); $post = new PostsController(); $post->render(); $post_error = $post->getError(); $posts = $post->getPosts(); $one = $post->getPost(); if (isset($_GET["profile"])) { if (is_numeric($_GET["profile"])) { $get_user_by_id = $user->getUserById($_GET["profile"]); if ($get_user_by_id === false) { $get_user_by_id = $user->getUserById(1); } } else { $get_user_by_id = $user->getUserById(1); } } ?> <!DOCTYPE html>
}); // processa o formulário de cadastro $app->post('/cadastro_salvar', function () { \Controllers\UsersController::store(); }); // página de cadastro finalizado $app->get('/cadastro_finalizado', function () { \View::make('user.created'); }); // painel do usuário $app->get('/painel-de-controle', function () { \Controllers\UsersController::controlPanel(); }); // alteração de senha $app->post('/alterar-senha', function () { \Controllers\UsersController::changePassword(); }); // formulário para cadastrar pergunta $app->get('/fazer-pergunta', function () { \Controllers\QuestionsController::create(); }); // processa o envio da pergunta $app->post('/enviar-pergunta', function () { \Controllers\QuestionsController::store(); }); // exibe a pergunta $app->get('/pergunta/:id', function ($id) { \Controllers\QuestionsController::show($id); }); // exibe o formulário de resposta $app->get('/responder/:question_id', function ($question_id) {