Passed
Push — master ( 02eff1...3c036d )
by Rakesh
01:52
created
member.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 require_once 'appconfig.php';
3 3
 
4 4
 if(isset($_SESSION['fb_access_token'])){
5
-  // Get access token from session
6
-  $accessToken = (string) $_SESSION['fb_access_token'];
5
+    // Get access token from session
6
+    $accessToken = (string) $_SESSION['fb_access_token'];
7 7
 /* 
8 8
 $fb = new Facebook\Facebook([
9 9
     'app_id' => $appId,
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 }*/
19 19
     echo $accessToken;
20 20
   
21
-  echo 'Welcome, ' . $user['name'];
22
-  echo '<a href="logout.php"  >Logout</a>';
21
+    echo 'Welcome, ' . $user['name'];
22
+    echo '<a href="logout.php"  >Logout</a>';
23 23
 
24 24
 // Get photo albums of Facebook page using Facebook Graph API
25 25
 $fields = "id,name,description,link,cover_photo,count";
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 
113 113
   <div style="text-align:center">
114 114
   <?php
115
-  if (is_array($fbPhotoData) || is_object($fbPhotoData))
116
-  { 
115
+    if (is_array($fbPhotoData) || is_object($fbPhotoData))
116
+    { 
117 117
     foreach($fbPhotoData as $data){
118
-      echo "<span class='dot'></span>";
119
-   }
120
-  }
121
-  ?>
118
+        echo "<span class='dot'></span>";
119
+    }
120
+    }
121
+    ?>
122 122
   </div>
123 123
 
124 124
 </div>
Please login to merge, or discard this patch.
fb-callback.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!session_id()) {
3
-  session_start();
3
+    session_start();
4 4
 }
5 5
 require_once 'lib\Facebook\autoload.php';
6 6
 
7
-  $appId='362540437809242';
8
-  $appSecret='538cd04f971479ff14dc409df2fbcf3b';
7
+    $appId='362540437809242';
8
+    $appSecret='538cd04f971479ff14dc409df2fbcf3b';
9 9
 $fb = new Facebook\Facebook([
10
-  'app_id' => $appId, // variable with My Facebook App ID
11
-  'app_secret' => $appSecret,
12
-  'default_graph_version' => 'v3.2',
13
-  ]);
10
+    'app_id' => $appId, // variable with My Facebook App ID
11
+    'app_secret' => $appSecret,
12
+    'default_graph_version' => 'v3.2',
13
+    ]);
14 14
 $helper = $fb->getRedirectLoginHelper();
15 15
 try {
16
-  $accessToken = $helper->getAccessToken();
16
+    $accessToken = $helper->getAccessToken();
17 17
 } catch(Facebook\Exceptions\FacebookResponseException $e) {
18
-  // When Graph returns an error
19
-  echo 'Graph returned an error: ' . $e->getMessage();
20
-  exit;
18
+    // When Graph returns an error
19
+    echo 'Graph returned an error: ' . $e->getMessage();
20
+    exit;
21 21
 } catch(Facebook\Exceptions\FacebookSDKException $e) {
22
-  // When validation fails or other local issues
23
-  echo 'Facebook SDK returned an error: ' . $e->getMessage();
24
-  exit;
22
+    // When validation fails or other local issues
23
+    echo 'Facebook SDK returned an error: ' . $e->getMessage();
24
+    exit;
25 25
 }
26 26
 if (! isset($accessToken)) {
27 27
   
28
-  if ($helper->getError()) {
28
+    if ($helper->getError()) {
29 29
     header('HTTP/1.0 401 Unauthorized');
30 30
     echo "Error: " . $helper->getError() . "\n";
31 31
     echo "Error Code: " . $helper->getErrorCode() . "\n";
32 32
     echo "Error Reason: " . $helper->getErrorReason() . "\n";
33 33
     echo "Error Description: " . $helper->getErrorDescription() . "\n";
34
-  } else {
34
+    } else {
35 35
     header('HTTP/1.0 400 Bad Request');
36 36
     echo 'Bad request';
37
-  }
38
-  exit;
37
+    }
38
+    exit;
39 39
 }
40 40
 // Logged in
41 41
 //echo '<h3>Access Token</h3>';
@@ -52,26 +52,26 @@  discard block
 block discarded – undo
52 52
 //$tokenMetadata->validateUserId('123');
53 53
 $tokenMetadata->validateExpiration();
54 54
 if (! $accessToken->isLongLived()) {
55
-  // Exchanges a short-lived access token for a long-lived one
56
-  try {
55
+    // Exchanges a short-lived access token for a long-lived one
56
+    try {
57 57
     $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
58
-  } catch (Facebook\Exceptions\FacebookSDKException $e) {
58
+    } catch (Facebook\Exceptions\FacebookSDKException $e) {
59 59
     echo "<p>Error getting long-lived access token: " . $e->getMessage() . "</p>\n\n";
60 60
     exit;
61
-  }
62
-  echo '<h3>Long-lived</h3>';
63
-  var_dump($accessToken->getValue());
61
+    }
62
+    echo '<h3>Long-lived</h3>';
63
+    var_dump($accessToken->getValue());
64 64
 }
65 65
 $_SESSION['fb_access_token'] = (string) $accessToken;
66 66
 try {
67
-  // Returns a `Facebook\FacebookResponse` object
68
-  $response = $fb->get('/me?fields=id,name', $accessToken);
67
+    // Returns a `Facebook\FacebookResponse` object
68
+    $response = $fb->get('/me?fields=id,name', $accessToken);
69 69
 } catch(Facebook\Exceptions\FacebookResponseException $e) {
70
-  echo 'Graph returned an error: ' . $e->getMessage();
71
-  exit;
70
+    echo 'Graph returned an error: ' . $e->getMessage();
71
+    exit;
72 72
 } catch(Facebook\Exceptions\FacebookSDKException $e) {
73
-  echo 'Facebook SDK returned an error: ' . $e->getMessage();
74
-  exit;
73
+    echo 'Facebook SDK returned an error: ' . $e->getMessage();
74
+    exit;
75 75
 }
76 76
 $user = $response->getGraphUser();
77 77
 
@@ -92,26 +92,26 @@  discard block
 block discarded – undo
92 92
 // Render all photo albums
93 93
 echo "<br/><br/>";
94 94
 foreach($fbAlbumData as $data){
95
-  $id = isset($data['id'])?$data['id']:'';
96
-  $name = isset($data['name'])?$data['name']:'';
97
-  $description = isset($data['description'])?$data['description']:'';
98
-  $link = isset($data['link'])?$data['link']:'';
99
-  $cover_photo_id = isset($data['cover_photo']['id'])?$data['cover_photo']['id']:'';
100
-  $count = isset($data['count'])?$data['count']:'';
95
+    $id = isset($data['id'])?$data['id']:'';
96
+    $name = isset($data['name'])?$data['name']:'';
97
+    $description = isset($data['description'])?$data['description']:'';
98
+    $link = isset($data['link'])?$data['link']:'';
99
+    $cover_photo_id = isset($data['cover_photo']['id'])?$data['cover_photo']['id']:'';
100
+    $count = isset($data['count'])?$data['count']:'';
101 101
   
102
-  $pictureLink = "fb-callback.php?album_id={$id}&album_name={$name}";
102
+    $pictureLink = "fb-callback.php?album_id={$id}&album_name={$name}";
103 103
   
104 104
 
105
-  echo "<a href='{$pictureLink}'>";
106
-  $cover_photo_id = (!empty($cover_photo_id ))?$cover_photo_id : 123456;
107
-  echo "<img width=100px height=100px src='https://graph.facebook.com/v3.2/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>";
108
-  echo "</a>";
109
-  echo "<p>{$name}</p>";
105
+    echo "<a href='{$pictureLink}'>";
106
+    $cover_photo_id = (!empty($cover_photo_id ))?$cover_photo_id : 123456;
107
+    echo "<img width=100px height=100px src='https://graph.facebook.com/v3.2/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>";
108
+    echo "</a>";
109
+    echo "<p>{$name}</p>";
110 110
 
111
-  $photoCount = ($count > 1)?$count. 'Photos':$count. 'Photo';
111
+    $photoCount = ($count > 1)?$count. 'Photos':$count. 'Photo';
112 112
   
113
-  echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>";
114
-  echo "<p>{$description}</p>";
113
+    echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>";
114
+    echo "<p>{$description}</p>";
115 115
 }
116 116
 
117 117
 $album_id = isset($_GET['album_id'])?$_GET['album_id']:header('Location: fb-callback.php');
@@ -130,17 +130,17 @@  discard block
 block discarded – undo
130 130
 // Render all photos   
131 131
 if (is_array($fbPhotoData) || is_object($fbPhotoData))
132 132
 {  
133
-  foreach($fbPhotoData as $data)
134
-  {
135
-      $imageData = end($data['images']);
136
-      $imgSource = isset($imageData['source'])?$imageData['source']:'';
137
-      $name = isset($data['name'])?$data['name']:'';
138
-
139
-      echo "<div class='item'>";
140
-      echo "<img src='{$imgSource}' alt=''>";
141
-      echo "<p>{$name}</p>";
142
-      echo "</div>";
143
-  }
133
+    foreach($fbPhotoData as $data)
134
+    {
135
+        $imageData = end($data['images']);
136
+        $imgSource = isset($imageData['source'])?$imageData['source']:'';
137
+        $name = isset($data['name'])?$data['name']:'';
138
+
139
+        echo "<div class='item'>";
140
+        echo "<img src='{$imgSource}' alt=''>";
141
+        echo "<p>{$name}</p>";
142
+        echo "</div>";
143
+    }
144 144
 }
145 145
 
146 146
 
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 echo "<div class='slideshow-container'>";
150 150
 
151 151
 // Render all photos 
152
-  if (is_array($fbPhotoData) || is_object($fbPhotoData))
153
-  {   
154
-      foreach($fbPhotoData as $data){
155
-      $imageData = end($data['images']);
156
-      $imgSource = isset($imageData['source'])?$imageData['source']:'';
157
-      $name = isset($data['name'])?$data['name']:'';
158
-
159
-      echo "<div class='mySlides fade'>";
160
-      echo "<img src='{$imgSource}' alt='' style='width:100%'>";
161
-      echo "<div class='text'>{$name}</div>";
162
-      echo "</div>";
163
-  }
152
+    if (is_array($fbPhotoData) || is_object($fbPhotoData))
153
+    {   
154
+        foreach($fbPhotoData as $data){
155
+        $imageData = end($data['images']);
156
+        $imgSource = isset($imageData['source'])?$imageData['source']:'';
157
+        $name = isset($data['name'])?$data['name']:'';
158
+
159
+        echo "<div class='mySlides fade'>";
160
+        echo "<img src='{$imgSource}' alt='' style='width:100%'>";
161
+        echo "<div class='text'>{$name}</div>";
162
+        echo "</div>";
163
+    }
164 164
 }
165 165
 
166 166
 ?>
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 <?php
172 172
 if (is_array($fbPhotoData) || is_object($fbPhotoData))
173 173
 { 
174
-  foreach($fbPhotoData as $data){
174
+    foreach($fbPhotoData as $data){
175 175
     echo "<span class='dot'></span>";
176
- }
176
+    }
177 177
 }
178 178
 ?>
179 179
 </div>
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 if(!session_id()) {
3
-  session_start();
3
+    session_start();
4 4
 }
5 5
 require_once 'appconfig.php';
6 6
 
7 7
 $fb = new Facebook\Facebook([
8
-  'app_id' => $appId,
9
-  'app_secret' => $appSecret,
10
-  'default_graph_version' => 'v3.2',
11
-  ]);
8
+    'app_id' => $appId,
9
+    'app_secret' => $appSecret,
10
+    'default_graph_version' => 'v3.2',
11
+    ]);
12 12
 
13 13
 $helper = $fb->getRedirectLoginHelper();
14 14
 
Please login to merge, or discard this patch.