Passed
Push — master ( 87a9ab...35ab17 )
by Rakesh
01:43
created
fb-callback.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
   'default_graph_version' => 'v3.2',
16 16
   ]);
17 17
 $helper = $fb->getRedirectLoginHelper();
18
-if(isset($_GET['state'])){
19
-  $helper->getPersistentDataHandler()->set('state',$_GET['state']);
18
+if (isset($_GET['state'])) {
19
+  $helper->getPersistentDataHandler()->set('state', $_GET['state']);
20 20
 }
21 21
 try {
22 22
   $accessToken = $helper->getAccessToken();
23
-} catch(Facebook\Exceptions\FacebookResponseException $e) {
23
+} catch (Facebook\Exceptions\FacebookResponseException $e) {
24 24
   // When Graph returns an error
25 25
   echo 'Graph returned an error: ' . $e->getMessage();
26 26
   exit;
27
-} catch(Facebook\Exceptions\FacebookSDKException $e) {
27
+} catch (Facebook\Exceptions\FacebookSDKException $e) {
28 28
   // When validation fails or other local issues
29 29
   echo 'Facebook SDK returned an error: ' . $e->getMessage();
30 30
   exit;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 // If you know the user ID this access token belongs to, you can validate it here
57 57
 //$tokenMetadata->validateUserId('123');
58 58
 $tokenMetadata->validateExpiration();
59
-if (! $accessToken->isLongLived()) {
59
+if (!$accessToken->isLongLived()) {
60 60
   // Exchanges a short-lived access token for a long-lived one
61 61
   try {
62 62
     $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
   var_dump($accessToken->getValue());
69 69
 }
70 70
 
71
-$_SESSION['fb_access_token'] = (string) $accessToken;
71
+$_SESSION['fb_access_token'] = (string)$accessToken;
72 72
 
73 73
 //echo $_SESSION['fb_access_token'];
74 74
 
Please login to merge, or discard this patch.
slideshow.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@  discard block
 block discarded – undo
10 10
 require_once 'appconfig.php';
11 11
 require_once 'fb-callback.php';
12 12
 
13
-if(isset($_SESSION['fb_access_token'])){
13
+if (isset($_SESSION['fb_access_token'])) {
14 14
 
15
-  $accessToken = (string) $_SESSION['fb_access_token'];
15
+  $accessToken = (string)$_SESSION['fb_access_token'];
16 16
 }
17 17
   $graphActLink = "https://graph.facebook.com/oauth/access_token?client_id={$appId}&client_secret={$appSecret}&grant_type=client_credentials";
18 18
     // Retrieve access token
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     // Store access token in session
24 24
     $_SESSION['fb_access_token'] = $accessToken;
25 25
 
26
-if(isset($_GET['album_id']) && isset($_GET['album_name'])){
27
-  $album_id =  $_GET['album_id'];
26
+if (isset($_GET['album_id']) && isset($_GET['album_name'])) {
27
+  $album_id = $_GET['album_id'];
28 28
   $album_name = $_GET['album_name'];
29 29
 
30 30
 // Get photos of Facebook page album using Facebook Graph API
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
 // Facebook photos content
36 36
 $fbPhotoData = $fbPhotoObj['data'];
37 37
 
38
-if(empty($fbPhotoData)){}else{echo "<h2>" . $album_name . "</h2>";}
38
+if (empty($fbPhotoData)) {} else {echo "<h2>" . $album_name . "</h2>"; }
39 39
 
40 40
 
41 41
 echo '<div class="slideshow-container">';
42 42
 
43 43
 // Render all photos
44
-if (is_array($fbPhotoData) || is_object($fbPhotoData) && $fbPhotoData!=null)
44
+if (is_array($fbPhotoData) || is_object($fbPhotoData) && $fbPhotoData != null)
45 45
     {
46
-foreach($fbPhotoData as $data){
46
+foreach ($fbPhotoData as $data) {
47 47
     $imageData = end($data['images']);
48
-    $imgSource = isset($imageData['source'])?$imageData['source']:'';
49
-    $name = isset($data['name'])?$data['name']:'';
48
+    $imgSource = isset($imageData['source']) ? $imageData['source'] : '';
49
+    $name = isset($data['name']) ? $data['name'] : '';
50 50
     
51 51
     echo '<div class="mySlides fade">';
52 52
     echo "<img src='{$imgSource}' alt='' style='width:90%;height:80%' />";
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 echo '</div>';
58 58
 echo '<br/>';
59 59
 echo '<div style="text-align:center">';
60
-  foreach($fbPhotoData as $data){
60
+  foreach ($fbPhotoData as $data) {
61 61
       echo '<span class="dot"></span>';
62 62
     }
63 63
     echo '</div>';
64
-}else{
64
+} else {
65 65
   echo "We care for your privacy. Only public photos will be displayed !";
66 66
 }
67 67
 }
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
   
11 11
   $helper = $fb->getRedirectLoginHelper();
12 12
   
13
-  $permissions = ['email','user_photos','user_videos','user_posts','user_link','user_status','user_link']; // Optional permissions
14
-  $loginUrl = $helper->getLoginUrl($CallbackUrl,$permissions);
13
+  $permissions = ['email', 'user_photos', 'user_videos', 'user_posts', 'user_link', 'user_status', 'user_link']; // Optional permissions
14
+  $loginUrl = $helper->getLoginUrl($CallbackUrl, $permissions);
15 15
   
16 16
   echo "<h3> Connect Clicking Below Facebook Icon Using Your Facebook Account.<h3>";
17
-  echo '<a href="' .htmlspecialchars($loginUrl).'"><img alt="Login With Facebook" src="images/fb_icon.png"></a>';
18 17
\ No newline at end of file
18
+  echo '<a href="' . htmlspecialchars($loginUrl) . '"><img alt="Login With Facebook" src="images/fb_icon.png"></a>';
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
member.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
 <?php
9 9
 require_once 'appconfig.php';
10 10
 require_once 'fb-callback.php';
11
-if(isset($_SESSION['fb_access_token'])){
11
+if (isset($_SESSION['fb_access_token'])) {
12 12
     try {
13 13
         // Returns a `Facebook\FacebookResponse` object
14 14
         $response = $fb->get('/me?fields=id,name', $accessToken);
15
-      } catch(Facebook\Exceptions\FacebookResponseException $e) {
15
+      } catch (Facebook\Exceptions\FacebookResponseException $e) {
16 16
         echo 'Graph returned an error: ' . $e->getMessage();
17 17
         exit;
18
-      } catch(Facebook\Exceptions\FacebookSDKException $e) {
18
+      } catch (Facebook\Exceptions\FacebookSDKException $e) {
19 19
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
20 20
         exit;
21 21
       }
@@ -38,32 +38,32 @@  discard block
 block discarded – undo
38 38
       
39 39
       // Render all photo albums
40 40
       echo "<br/><br/>";
41
-      foreach($fbAlbumData as $data){
42
-          $id = isset($data['id'])?$data['id']:'';
43
-          $name = isset($data['name'])?$data['name']:'';
44
-          $description = isset($data['description'])?$data['description']:'';
45
-          $link = isset($data['link'])?$data['link']:'';
41
+      foreach ($fbAlbumData as $data) {
42
+          $id = isset($data['id']) ? $data['id'] : '';
43
+          $name = isset($data['name']) ? $data['name'] : '';
44
+          $description = isset($data['description']) ? $data['description'] : '';
45
+          $link = isset($data['link']) ? $data['link'] : '';
46 46
           $photos = "https://graph.facebook.com/v3.2/{$id}/photos?access_token={$accessToken}";
47
-          $cover_photo_id = isset($data['cover_photo']['id'])?$data['cover_photo']['id']:'';
48
-          $count = isset($data['count'])?$data['count']:'';
47
+          $cover_photo_id = isset($data['cover_photo']['id']) ? $data['cover_photo']['id'] : '';
48
+          $count = isset($data['count']) ? $data['count'] : '';
49 49
           
50 50
           $pictureLink = "slideshow.php?album_id={$id}&album_name={$name}";
51 51
           echo "<div class='carding'>";
52 52
           echo "<a href='{$pictureLink}'>";
53
-          $cover_photo_id = (!empty($cover_photo_id))?$cover_photo_id : 123456;
53
+          $cover_photo_id = (!empty($cover_photo_id)) ? $cover_photo_id : 123456;
54 54
           echo "<img width=200px height=200px src='https://graph.facebook.com/v3.2/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>";
55 55
           echo "<p>{$name}</p>";
56 56
           echo "</a>";
57 57
           //echo "$images";
58 58
           echo "<a href='{$photos}'> <button type='button'> Download Album </Button> </a>";
59 59
       
60
-          $photoCount = ($count > 1)?$count. 'Photos':$count. 'Photo';
60
+          $photoCount = ($count > 1) ? $count . 'Photos' : $count . 'Photo';
61 61
           
62 62
           echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>";
63 63
           echo "<p>{$description}</p>";
64 64
           echo "</div>";
65 65
       }
66
-}else{
66
+} else {
67 67
     header('Location: index.php');
68 68
 }
69 69
 ?>
Please login to merge, or discard this patch.