Passed
Push — master ( 1ffcd5...02eff1 )
by Rakesh
01:37
created
appconfig.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
     require_once 'lib\Facebook\autoload.php';
3 3
     if(!session_id()) {
4
-      session_start();
4
+        session_start();
5 5
     }
6 6
     $appId = '362540437809242'; // my facebook app id
7 7
     $appSecret = '538cd04f971479ff14dc409df2fbcf3b';
Please login to merge, or discard this patch.
fb-callback.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -3,37 +3,37 @@  discard block
 block discarded – undo
3 3
 require_once 'appconfig.php';
4 4
 
5 5
     $fb = new Facebook\Facebook([
6
-      'app_id' => $appId,
7
-      'app_secret' => $appSecret,
8
-      'default_graph_version' => 'v3.2',
9
-      ]);
6
+        'app_id' => $appId,
7
+        'app_secret' => $appSecret,
8
+        'default_graph_version' => 'v3.2',
9
+        ]);
10 10
     
11 11
     $helper = $fb->getRedirectLoginHelper();
12 12
 
13 13
 try {
14
-  $accessToken = $helper->getAccessToken();
14
+    $accessToken = $helper->getAccessToken();
15 15
 } catch(Facebook\Exceptions\FacebookResponseException $e) {
16
-  // When Graph returns an error
17
-  echo 'Graph returned an error: ' . $e->getMessage();
18
-  exit;
16
+    // When Graph returns an error
17
+    echo 'Graph returned an error: ' . $e->getMessage();
18
+    exit;
19 19
 } catch(Facebook\Exceptions\FacebookSDKException $e) {
20
-  // When validation fails or other local issues
21
-  echo 'Facebook SDK returned an error: ' . $e->getMessage();
22
-  exit;
20
+    // When validation fails or other local issues
21
+    echo 'Facebook SDK returned an error: ' . $e->getMessage();
22
+    exit;
23 23
 }
24 24
 
25 25
 if (! isset($accessToken)) {
26
-  if ($helper->getError()) {
26
+    if ($helper->getError()) {
27 27
     header('HTTP/1.0 401 Unauthorized');
28 28
     echo "Error: " . $helper->getError() . "\n";
29 29
     echo "Error Code: " . $helper->getErrorCode() . "\n";
30 30
     echo "Error Reason: " . $helper->getErrorReason() . "\n";
31 31
     echo "Error Description: " . $helper->getErrorDescription() . "\n";
32
-  } else {
32
+    } else {
33 33
     header('HTTP/1.0 400 Bad Request');
34 34
     echo 'Bad request';
35
-  }
36
-  exit;
35
+    }
36
+    exit;
37 37
 }
38 38
 
39 39
 // Logged in
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
 $tokenMetadata->validateExpiration();
56 56
 
57 57
 if (! $accessToken->isLongLived()) {
58
-  // Exchanges a short-lived access token for a long-lived one
59
-  try {
58
+    // Exchanges a short-lived access token for a long-lived one
59
+    try {
60 60
     $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
61
-  } catch (Facebook\Exceptions\FacebookSDKException $e) {
61
+    } catch (Facebook\Exceptions\FacebookSDKException $e) {
62 62
     echo "<p>Error getting long-lived access token: " . $e->getMessage() . "</p>\n\n";
63 63
     exit;
64
-  }
64
+    }
65 65
 
66
-  echo '<h3>Long-lived</h3>';
67
-  var_dump($accessToken->getValue());
66
+    echo '<h3>Long-lived</h3>';
67
+    var_dump($accessToken->getValue());
68 68
 }
69 69
 
70 70
 $_SESSION['fb_access_token'] = (string) $accessToken;
71 71
 
72
-  header("Location:member.php");
72
+    header("Location:member.php");
73 73
 ?>
74 74
\ No newline at end of file
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 require_once 'appconfig.php';
3 3
 
4 4
 $fb = new Facebook\Facebook([
5
-  'app_id' => $appId,
6
-  'app_secret' => $appSecret,
7
-  'default_graph_version' => 'v3.2',
8
-  ]);
5
+    'app_id' => $appId,
6
+    'app_secret' => $appSecret,
7
+    'default_graph_version' => 'v3.2',
8
+    ]);
9 9
 
10 10
 $helper = $fb->getRedirectLoginHelper();
11 11
 
Please login to merge, or discard this patch.
member.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,27 +2,27 @@  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 = $_SESSION['fb_access_token'];
5
+    // Get access token from session
6
+    $accessToken = $_SESSION['fb_access_token'];
7 7
 
8
-  $fb = new Facebook\Facebook([
8
+    $fb = new Facebook\Facebook([
9 9
     'app_id' => $appId,
10 10
     'app_secret' => $appSecret,
11 11
     'default_graph_version' => 'v3.2',
12 12
     ]);
13 13
 
14
-  try {
14
+    try {
15 15
     // Returns a `Facebook\FacebookResponse` object
16 16
     $response = $fb->get('/me?fields=id,name', $accessToken);
17
-  } catch(Facebook\Exceptions\FacebookResponseException $e) {
17
+    } catch(Facebook\Exceptions\FacebookResponseException $e) {
18 18
     echo 'Graph returned an error: ' . $e->getMessage();
19 19
     exit;
20
-  } catch(Facebook\Exceptions\FacebookSDKException $e) {
20
+    } catch(Facebook\Exceptions\FacebookSDKException $e) {
21 21
     echo 'Facebook SDK returned an error: ' . $e->getMessage();
22 22
     exit;
23
-  }
23
+    }
24 24
   
25
-  $user = $response->getGraphUser();
25
+    $user = $response->getGraphUser();
26 26
   
27 27
 //echo '<br/> User ID: ' . $user['id']; 
28 28
 echo '<br/> Welcome , ' . $user['name'];
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 
119 119
   <div style="text-align:center">
120 120
   <?php
121
-  if (is_array($fbPhotoData) || is_object($fbPhotoData))
122
-  { 
121
+    if (is_array($fbPhotoData) || is_object($fbPhotoData))
122
+    { 
123 123
     foreach($fbPhotoData as $data){
124
-      echo "<span class='dot'></span>";
125
-   }
126
-  }
127
-  ?>
124
+        echo "<span class='dot'></span>";
125
+    }
126
+    }
127
+    ?>
128 128
   </div>
129 129
 
130 130
 </div>
Please login to merge, or discard this patch.