Example #1
0
 public function removePostAction()
 {
     if (isset($_SESSION['user']) && isset($_GET['id'])) {
         $result = removePost($_GET['id']);
         if ($result != 1) {
             $error = 'Crap';
             include APPLICATION_PATH . '/views/Error.html.php';
             exit;
         } else {
             header('Location: ../');
             die;
         }
     }
     header('Location: ../');
     die;
 }
}
if ($decoded != null) {
    if ($decoded->function == 'createPost') {
        createPost($decoded->post);
    } else {
        if ($decoded->function == 'createTema') {
            createTema($decoded->tema);
        } else {
            if ($decoded->function == 'updatePost') {
                updatePost($decoded->post);
            } else {
                if ($decoded->function == 'updateTema') {
                    updateTema($decoded->tema);
                } else {
                    if ($decoded->function == 'removePost') {
                        removePost($decoded->post_id);
                    } else {
                        if ($decoded->function == 'removeTema') {
                            removeTema($decoded->tema_id);
                        }
                    }
                }
            }
        }
    }
} else {
    $function = $_GET["function"];
    if ($function == 'getPosts') {
        getPosts();
    } elseif ($function == 'getTemas') {
        getTemas($_GET["todos"]);