コード例 #1
0
ファイル: index.php プロジェクト: nikhilsaldanha/Blog-It
    $empty = 0;
    $postDetails = $post->getTopPostsByUser($uid);
    $userDetails = $user->getUser($uid);
    if (gettype($postDetails) == 'string') {
        $app->notFound();
    }
    if ($postDetails->num_rows == 0) {
        $empty = 1;
    }
    session_start();
    if ($user->isLoggedIn()) {
        $loggedIn = 1;
    }
    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");