Completed
Push — master ( 276db7...0bd148 )
by Rakesh
07:30 queued 03:39
created
slideshow.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 session_start();
10 10
 require_once 'appconfig.php';
11 11
 
12
-if(isset($_SESSION['fb_access_token'])){
12
+if (isset($_SESSION['fb_access_token'])) {
13 13
 
14
-    $accessToken = (string) $_SESSION['fb_access_token'];
14
+    $accessToken = (string)$_SESSION['fb_access_token'];
15 15
 
16 16
     $graphActLink = "https://graph.facebook.com/oauth/access_token?client_id={$appId}&client_secret={$appSecret}&grant_type=client_credentials";
17 17
     // Retrieve access token
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 echo '</div>';
56 56
 echo '<br/>';
57 57
 echo '<div style="text-align:center">';
58
-    foreach($fbPhotoData as $data){
58
+    foreach ($fbPhotoData as $data) {
59 59
         echo '<span class="dot"></span>';
60 60
     }
61 61
     echo '</div>';
62
-}else{
62
+} else {
63 63
     echo "We care for your privacy. Only public photos will be displayed !";
64 64
 }
65 65
 }
66
-}else{
66
+} else {
67 67
     header("Location: index.php");
68 68
 }
69 69
 //}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@
 block discarded – undo
59 59
         echo '<span class="dot"></span>';
60 60
     }
61 61
     echo '</div>';
62
-}else{
62
+} else{
63 63
     echo "We care for your privacy. Only public photos will be displayed !";
64 64
 }
65 65
 }
66
-}else{
66
+} else{
67 67
     header("Location: index.php");
68 68
 }
69 69
 //}
Please login to merge, or discard this patch.
member.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
     ]);
24 24
 $helper = $fb->getRedirectLoginHelper();
25 25
 
26
-if(isset($_GET['state'])){
27
-    $helper->getPersistentDataHandler()->set('state',$_GET['state']);
26
+if (isset($_GET['state'])) {
27
+    $helper->getPersistentDataHandler()->set('state', $_GET['state']);
28 28
 }
29 29
 
30
-if(isset($_SESSION['fb_access_token'])){ 
30
+if (isset($_SESSION['fb_access_token'])) { 
31 31
     try {
32 32
         $accessToken = $_SESSION['fb_access_token'];
33 33
         // Returns a `Facebook\FacebookResponse` object
34 34
         $response = $fb->get('/me?fields=id,name', $accessToken);
35
-        } catch(Facebook\Exceptions\FacebookResponseException $e) {
35
+        } catch (Facebook\Exceptions\FacebookResponseException $e) {
36 36
         echo 'Graph returned an error: ' . $e->getMessage();
37 37
         exit;
38
-        } catch(Facebook\Exceptions\FacebookSDKException $e) {
38
+        } catch (Facebook\Exceptions\FacebookSDKException $e) {
39 39
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
40 40
         exit;
41 41
         }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 								<span class="navbar-toggler-icon"></span>
53 53
 							</button>
54 54
 							<a class="navbar-brand" href="#" id="username">
55
-								<img src="<?php echo 'https://graph.facebook.com/'.$userid.'/picture';?>" id="user_photo" class="img-circle" />
56
-								<span style="margin-left: 5px;"><?php echo $user['name'];?></span>
55
+								<img src="<?php echo 'https://graph.facebook.com/' . $userid . '/picture'; ?>" id="user_photo" class="img-circle" />
56
+								<span style="margin-left: 5px;"><?php echo $user['name']; ?></span>
57 57
 							</a>
58 58
 						</div>
59 59
 <!--//echo "<img src='https://graph.facebook.com/{$userid}/picture&access_token={$accessToken}' />"; -->
@@ -136,36 +136,36 @@  discard block
 block discarded – undo
136 136
       
137 137
         // Render all photo albums
138 138
         echo "<br/><br/>";
139
-        foreach($fbAlbumData as $data){
140
-            $id = isset($data['id'])?$data['id']:'';
141
-            $name = isset($data['name'])?$data['name']:'';
142
-            $description = isset($data['description'])?$data['description']:'';
143
-            $link = isset($data['link'])?$data['link']:'';
139
+        foreach ($fbAlbumData as $data) {
140
+            $id = isset($data['id']) ? $data['id'] : '';
141
+            $name = isset($data['name']) ? $data['name'] : '';
142
+            $description = isset($data['description']) ? $data['description'] : '';
143
+            $link = isset($data['link']) ? $data['link'] : '';
144 144
             $photos = "https://graph.facebook.com/v3.3/{$id}/photos?access_token={$accessToken}";
145
-            $cover_photo_id = isset($data['cover_photo']['id'])?$data['cover_photo']['id']:'';
146
-            $count = isset($data['count'])?$data['count']:'';
145
+            $cover_photo_id = isset($data['cover_photo']['id']) ? $data['cover_photo']['id'] : '';
146
+            $count = isset($data['count']) ? $data['count'] : '';
147 147
           
148 148
             $pictureLink = "slideshow.php?album_id={$id}&album_name={$name}";
149 149
             echo "<div class='carding'>";
150 150
             echo "<a href='{$pictureLink}'>";
151
-            $cover_photo_id = (!empty($cover_photo_id))?$cover_photo_id : 123456;
151
+            $cover_photo_id = (!empty($cover_photo_id)) ? $cover_photo_id : 123456;
152 152
             echo "<img width=200px height=200px src='https://graph.facebook.com/v3.3/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>";
153 153
             echo "<p>{$name}</p>";
154 154
             echo "</a>";
155 155
             //echo "$images";
156 156
           
157
-            $photoCount = ($count > 1)?$count. 'Photos':$count. 'Photo';
157
+            $photoCount = ($count > 1) ? $count . 'Photos' : $count . 'Photo';
158 158
           
159 159
             echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>";
160 160
             echo "<p>{$description}</p>";
161 161
             ?><div class="caption">
162
-															<button rel="<?php echo $id.','.$name;?>" class="single-download btn btn-primary pull-left" title="Download Album">
162
+															<button rel="<?php echo $id . ',' . $name; ?>" class="single-download btn btn-primary pull-left" title="Download Album">
163 163
 																<span class="fas fa-download" ></span>
164 164
 															</button>
165 165
 
166
-															<input type="checkbox" class="select-album" value="<?php echo $id.','.$name;?>" />
166
+															<input type="checkbox" class="select-album" value="<?php echo $id . ',' . $name; ?>" />
167 167
 
168
-															<span rel="<?php echo $id.','.$name;?>" class="move-single-album btn btn-danger pull-right" title="Move to Google">
168
+															<span rel="<?php echo $id . ',' . $name; ?>" class="move-single-album btn btn-danger pull-right" title="Move to Google">
169 169
                               <span class="fas fa-file-export"></span>
170 170
 															</span>
171 171
 														</div>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         }
178 178
         ?>
179 179
       </div>
180
-<?php }else{
180
+<?php } else {
181 181
     header("Location: index.php");
182 182
 }
183 183
 ?>
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
         }
178 178
         ?>
179 179
       </div>
180
-<?php }else{
180
+<?php } else{
181 181
     header("Location: index.php");
182 182
 }
183 183
 ?>
Please login to merge, or discard this patch.
functions.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     $session = $_SESSION['fb_access_token'];
19 19
 
20 20
     $zip_folder = "";
21
-    $album_download_directory = 'lib/resources/albums/'.uniqid().'/';
21
+    $album_download_directory = 'lib/resources/albums/' . uniqid() . '/';
22 22
     mkdir($album_download_directory, 0777);
23 23
 
24 24
     function download_album($session, $album_download_directory, $album_id, $album_name) {
@@ -31,39 +31,39 @@  discard block
 block discarded – undo
31 31
         $response_album_photos = file_get_contents($request_album_photos);			
32 32
         $album_photos = json_decode($response_album_photos, true, 512, JSON_BIGINT_AS_STRING);
33 33
 
34
-        $album_directory = $album_download_directory.$album_name;
35
-        if ( !file_exists( $album_directory ) ) {
34
+        $album_directory = $album_download_directory . $album_name;
35
+        if (!file_exists($album_directory)) {
36 36
             mkdir($album_directory, 0777);
37 37
         }
38 38
 
39 39
         $i = 1;
40
-        foreach ( $album_photos['data'] as $album_photo ) {
41
-            $album_photo = (array) $album_photo;
42
-            file_put_contents( $album_directory.'/'.$i.".jpg", fopen( $album_photo['source'], 'r') );
40
+        foreach ($album_photos['data'] as $album_photo) {
41
+            $album_photo = (array)$album_photo;
42
+            file_put_contents($album_directory . '/' . $i . ".jpg", fopen($album_photo['source'], 'r'));
43 43
             $i++;
44 44
         }
45 45
     }
46 46
 
47 47
     //---------- For 1 album download -------------------------------------------------//
48
-    if ( isset( $_GET['single_album'] ) && !empty ( $_GET['single_album'] ) ) {
48
+    if (isset($_GET['single_album']) && !empty ($_GET['single_album'])) {
49 49
         
50
-        $single_album = explode( ",", $_GET['single_album'] );
51
-        download_album( $session, $album_download_directory, $single_album[0], $single_album[1] );
50
+        $single_album = explode(",", $_GET['single_album']);
51
+        download_album($session, $album_download_directory, $single_album[0], $single_album[1]);
52 52
     }
53 53
 	
54 54
     //---------- For Selected Albums download -----------------------------------------//
55
-    if ( isset( $_GET['selected_albums'] ) and count( $_GET['selected_albums'] ) > 0) {
55
+    if (isset($_GET['selected_albums']) and count($_GET['selected_albums']) > 0) {
56 56
         $selected_albums = explode("/", $_GET['selected_albums']);
57 57
 
58
-        foreach ( $selected_albums as $selected_album ) {
59
-            $selected_album = explode( ",", $selected_album );
60
-            download_album( $session, $album_download_directory, $selected_album[0], $selected_album[1] );
58
+        foreach ($selected_albums as $selected_album) {
59
+            $selected_album = explode(",", $selected_album);
60
+            download_album($session, $album_download_directory, $selected_album[0], $selected_album[1]);
61 61
         }
62 62
     }
63 63
 
64 64
     //---------- Download all album code -------------------------------------------------//
65
-    if ( isset( $_GET['all_albums'] ) && !empty ( $_GET['all_albums'] ) ) {
66
-        if ( $_GET['all_albums'] == 'all_albums' ) {
65
+    if (isset($_GET['all_albums']) && !empty ($_GET['all_albums'])) {
66
+        if ($_GET['all_albums'] == 'all_albums') {
67 67
 
68 68
             // graph api request for user data
69 69
 			
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
             // get response
74 74
             $albums = json_decode($response_albums, true, 512, JSON_BIGINT_AS_STRING);
75 75
 
76
-            if ( !empty( $albums ) ) {
77
-                foreach ( $albums['data'] as $album ) {
78
-                    $album = (array) $album;
79
-                    download_album( $session, $album_download_directory, $album['id'], $album['name'] );
76
+            if (!empty($albums)) {
77
+                foreach ($albums['data'] as $album) {
78
+                    $album = (array)$album;
79
+                    download_album($session, $album_download_directory, $album['id'], $album['name']);
80 80
                 }
81 81
             }
82 82
         }
83 83
     }
84 84
 
85
-    if ( isset( $_GET['zip'] ) ) {
85
+    if (isset($_GET['zip'])) {
86 86
         require_once('zipper.php');
87 87
         $zipper = new zipper();
88 88
         echo $zipper->get_zip($album_download_directory);
Please login to merge, or discard this patch.