Completed
Push — master ( 27ce5d...276db7 )
by Rakesh
09:27
created

slideshow.php (1 issue)

Labels
Severity
1
<html>
2
<head>
3
<meta name="viewport" content="width=device-width, initial-scale=1">
4
<title>Slide Show of Album</title>
5
<link rel="stylesheet" type="text/css" href="lib/CSS/slider.css">
6
</head>
7
<body>
8
<?php
9
<<<<<<< HEAD
0 ignored issues
show
A parse error occurred: Syntax error, unexpected T_SL on line 9 at column 0
Loading history...
10
session_start();
11
=======
12
    session_start();
13
>>>>>>> 85e358e0c342f50861ef32c55d7303292e8d8f01
14
require_once 'appconfig.php';
15
16
if(isset($_SESSION['fb_access_token'])){
17
18
<<<<<<< HEAD
19
  $accessToken = (string) $_SESSION['fb_access_token'];
20
21
  $graphActLink = "https://graph.facebook.com/oauth/access_token?client_id={$appId}&client_secret={$appSecret}&grant_type=client_credentials";
22
=======
23
    $accessToken = (string) $_SESSION['fb_access_token'];
24
}
25
    $graphActLink = "https://graph.facebook.com/oauth/access_token?client_id={$appId}&client_secret={$appSecret}&grant_type=client_credentials";
26
>>>>>>> 85e358e0c342f50861ef32c55d7303292e8d8f01
27
    // Retrieve access token
28
    $accessTokenJson = file_get_contents($graphActLink);
29
    $accessTokenObj = json_decode($accessTokenJson);
30
    $accessToken = $accessTokenObj->access_token;
31
    
32
    // Store access token in session
33
    $_SESSION['fb_access_token'] = $accessToken;
34
35
if(isset($_GET['album_id']) && isset($_GET['album_name'])){
36
    $album_id =  $_GET['album_id'];
37
    $album_name = $_GET['album_name'];
38
39
// Get photos of Facebook page album using Facebook Graph API
40
$graphPhoLink = "https://graph.facebook.com/v3.3/{$album_id}/photos?fields=source,images,name&access_token={$accessToken}";
41
$jsonData = file_get_contents($graphPhoLink);
42
$fbPhotoObj = json_decode($jsonData, true, 512, JSON_BIGINT_AS_STRING);
43
44
// Facebook photos content
45
$fbPhotoData = $fbPhotoObj['data'];
46
47
if (empty($fbPhotoData)) {} else {echo "<h2>" . $album_name . "</h2>"; }
48
49
echo '<div class="slideshow-container">';
50
51
// Render all photos
52
if (is_array($fbPhotoData) || is_object($fbPhotoData) && $fbPhotoData != null)
53
    {
54
foreach ($fbPhotoData as $data) {
55
    $imageData = end($data['images']);
56
    $imgSource = isset($imageData['source']) ? $imageData['source'] : '';
57
    $name = isset($data['name']) ? $data['name'] : '';
58
    
59
    echo '<div class="mySlides fade">';
60
    echo "<img src='{$imgSource}' alt='' style='width:90%;height:80%' />";
61
    echo '<div class="text">' . $name . '</div>';
62
    echo '</div>';
63
}
64
65
echo '</div>';
66
echo '<br/>';
67
echo '<div style="text-align:center">';
68
    foreach($fbPhotoData as $data){
69
        echo '<span class="dot"></span>';
70
    }
71
    echo '</div>';
72
}else{
73
    echo "We care for your privacy. Only public photos will be displayed !";
74
}
75
}
76
}else{
77
  header("Location: index.php");
78
}
79
//}
80
?>
81
<script type="text/javascript" src="lib/JavaScript/slider.js"></script>
82
</body>
83
</html>