Exemplo n.º 1
0
    }
    if ($loggedIn) {
        $isFollowing = $follower->isFollowing($uid);
        $fol_count = $follower->getCount();
    }
    if (!$userDetails->num_rows == 0) {
        $app->render('author.php', array('loggedIn' => $loggedIn, 'fol_count' => $fol_count, 'postDetails' => $postDetails, 'userDetails' => $userDetails, 'empty' => $empty, 'isFollowing' => $isFollowing, 'follower' => $follower));
    }
});
//Handle follow request
$app->post('/follow/:id', function ($f_id) use($app) {
    require_once 'core/followers.inc.php';
    $follower = new Follower();
    session_start();
    //add logged in user as a follower of the author : f_id
    if ($follower->followMe($f_id, $_SESSION['user_id'])) {
    } else {
        echo "Error";
        die("Inserttion failed");
    }
    //finally redirect the user to the same
    $app->redirect('/Blog-It/author/' . $f_id);
});
$app->get('/post/:id', function ($pid) use($app) {
    require_once 'core/user.inc.php';
    require_once 'core/post.inc.php';
    require_once 'core/comment.inc.php';
    require_once 'core/tag.inc.php';
    $user = new User();
    $post = new Post();
    $comment = new Comment();