Passed
Branch master (9da6a4)
by Kishan
03:27
created
zipper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                         $zip->addEmptyDir(end($dir));
123 123
                     } else {
124 124
                         $zip->addFromString(
125
-                            end($dir).'/'.$i.'.jpg', 
125
+                            end($dir) . '/' . $i . '.jpg', 
126 126
                             file_get_contents($entry['file'])
127 127
                         );
128 128
                         $i++;
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
         $zipfilename = "";
167 167
         if (isset($album_download_directory)) {
168 168
             //$zipfilename = 'libs/resources'.DIRECTORY_SEPARATOR.'albums'.DIRECTORY_SEPARATOR.'fb-album_'.date("Y-m-d").'_'.date("H-i-s");
169
-            $zipfilename = 'public/fb-album_'.date("Y-m-d").'_'.date("H-i-s");
169
+            $zipfilename = 'public/fb-album_' . date("Y-m-d") . '_' . date("H-i-s");
170 170
             // name of folder starting from the root of the webserver
171 171
             // as in Wordpress /wp-content/themes/ (end on backslash)
172
-            $folder = dirname($_SERVER['PHP_SELF']).'/'.$album_download_directory;
172
+            $folder = dirname($_SERVER['PHP_SELF']) . '/' . $album_download_directory;
173 173
             // Server Root
174 174
             $root = $_SERVER["DOCUMENT_ROOT"];
175 175
             // source of the folder to unpack
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@
 block discarded – undo
45 45
             foreach ($files as $file) {
46 46
                 $file = str_replace('\\', '/', $file);
47 47
                 // Ignore "." and ".." folders
48
-                if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..')))
49
-                    continue;
48
+                if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..'))) {
49
+                                    continue;
50
+                }
50 51
                 $file = realpath($file);
51 52
                 if (is_dir($file) === true) {
52 53
                     $a[] = array(
Please login to merge, or discard this patch.
download-album.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
     $album_directory = $album_download_directory.$album_name;
49 49
     if (!file_exists($album_directory)) {
50
-         mkdir($album_directory, 0777);
50
+            mkdir($album_directory, 0777);
51 51
     }
52 52
 
53 53
     $i = 1;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 require_once "fb-callback.php";
22 22
 
23 23
 $zip_folder = "";
24
-$album_download_directory = 'public/'.uniqid().'/';
24
+$album_download_directory = 'public/' . uniqid() . '/';
25 25
 mkdir($album_download_directory, 0777, true);
26 26
 
27 27
 /**
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
     $fb
44 44
 ) {
45 45
     $request_album_photos = $fb->get($album_id . "/photos?fields=source", $accessToken); //photos?fields=source
46
-    $album_photos=$request_album_photos->getGraphEdge()->asArray();
46
+    $album_photos = $request_album_photos->getGraphEdge()->asArray();
47 47
 
48
-    $album_directory = $album_download_directory.$album_name;
48
+    $album_directory = $album_download_directory . $album_name;
49 49
     if (!file_exists($album_directory)) {
50 50
          mkdir($album_directory, 0777);
51 51
     }
52 52
 
53 53
     $i = 1;
54
-    foreach ( $album_photos as $album_photo ) {
54
+    foreach ($album_photos as $album_photo) {
55 55
         file_put_contents(
56
-            $album_directory.'/'.$i.".jpg", 
56
+            $album_directory . '/' . $i . ".jpg", 
57 57
             fopen($album_photo['source'], 'r')
58 58
         );
59 59
         $i++;
Please login to merge, or discard this patch.
login.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
  *
18 18
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
19 19
  */
20
-  require_once __DIR__ . "/config.php";
20
+    require_once __DIR__ . "/config.php";
21 21
 
22 22
 if (isset($_SESSION['accessToken'])) {
23 23
     header('Location: https://rtfbchallenge.000webhostapp.com/index.php'); 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     header('Location: https://rtfbchallenge.000webhostapp.com/index.php'); 
24 24
     exit();
25 25
 }
26
-$permissions = ['email','user_gender','user_location','user_photos'];
26
+$permissions = ['email', 'user_gender', 'user_location', 'user_photos'];
27 27
 $loginUrl = $helper->getLoginUrl(
28 28
     'https://rtfbchallenge.000webhostapp.com/index.php', 
29 29
     $permissions
Please login to merge, or discard this patch.
google_drive/google_login.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
20 20
  */
21 21
 ini_set('max_execution_time', 999999);
22
-require_once __DIR__.DIRECTORY_SEPARATOR.'gClient.php';
22
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'gClient.php';
23 23
 require_once "../fb-callback.php";
24 24
 
25
-$gClient =new CreateGoogleClient();
25
+$gClient = new CreateGoogleClient();
26 26
 $client = $gClient->createClient();
27 27
 
28 28
 if (isset($_SESSION['google_access_token']) && $_SESSION['google_access_token']) {
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     $drive = new Google_Service_Drive($client);
32 32
 
33
-    $rootFolderName = 'facebook_'.$_SESSION['userid'].'_albums';
33
+    $rootFolderName = 'facebook_' . $_SESSION['userid'] . '_albums';
34 34
             $fileMetaData = new Google_Service_Drive_DriveFile(
35 35
                 array(
36 36
                     'name' => $rootFolderName,
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
             array('fields' => 'id')
68 68
         );
69 69
 
70
-        $responseImg = $fb->get($albumId.'/photos?fields=source', $accessToken);
70
+        $responseImg = $fb->get($albumId . '/photos?fields=source', $accessToken);
71 71
         $graphNodeImg = $responseImg->getGraphEdge();
72 72
         $resultImg = json_decode($graphNodeImg);
73 73
 
74 74
         foreach ($resultImg as $images) {
75 75
             $url = $images->source;
76
-            $img = $images->id.".jpeg";
76
+            $img = $images->id . ".jpeg";
77 77
             $folderId = $SubFolder->id;
78 78
             $fileMetadata = new Google_Service_Drive_DriveFile(
79 79
                 array(
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                     'data' => $fileContent, 'mimeType' => 'image/jpeg',
89 89
                     'uploadType' => 'multipart', 'fields' => 'id')
90 90
                 );
91
-            }catch (Exception $e) {
91
+            } catch (Exception $e) {
92 92
                 $response = "Due to some reason uploading to drive is failed!";
93 93
                 print "An error occurred: " . $e->getMessage();
94 94
             }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     if (isset($_GET['selected_albums']) && !empty($_GET['selected_albums'])) {
114 114
         $response = '<span>Sorry due to some reasons albums is not moved to goofle drive.</span>';
115 115
         $selected_albums = explode("-", $_GET['selected_albums']);
116
-        foreach ( $selected_albums as $selected_album ) {
116
+        foreach ($selected_albums as $selected_album) {
117 117
             $selected_album = explode(",", $selected_album);
118 118
             moveToDrive(
119 119
                 $accessToken, 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
                     'data' => $fileContent, 'mimeType' => 'image/jpeg',
89 89
                     'uploadType' => 'multipart', 'fields' => 'id')
90 90
                 );
91
-            }catch (Exception $e) {
91
+            } catch (Exception $e) {
92 92
                 $response = "Due to some reason uploading to drive is failed!";
93 93
                 print "An error occurred: " . $e->getMessage();
94 94
             }
Please login to merge, or discard this patch.
google_drive/gClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
  *
19 19
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
20 20
  */
21
-require_once __DIR__.'/../vendor/autoload.php';
21
+require_once __DIR__ . '/../vendor/autoload.php';
22 22
 session_start();
23 23
 /**
24 24
  * Create a google Client for move album to Drive
Please login to merge, or discard this patch.
google_drive/g-callback.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
20 20
  */
21 21
 require_once 'gClient.php';
22
-$gClient =new CreateGoogleClient();
22
+$gClient = new CreateGoogleClient();
23 23
 $client = $gClient->createClient();
24 24
 
25
-if (! isset($_GET['code'])) {
25
+if (!isset($_GET['code'])) {
26 26
     $auth_url = $client->createAuthUrl();
27 27
     header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
28 28
 } else {
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 );
25 25
 $userData = $response->getGraphNode()->asArray();
26 26
 $_SESSION['userid'] = $userData['id'];
27
-$_SESSION['email']=$userData['email'];
27
+$_SESSION['email'] = $userData['email'];
28 28
 ?>
29 29
 
30 30
 <!DOCTYPE html>
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     <img src="<?php echo $userData['picture']['url'] ?>" alt="Profile Picture" class="circle">
94 94
                   </a>
95 95
                   <a href="#">
96
-                    <span class="name white-text"><?php echo $userData['first_name'] ." ".$userData['last_name'] ?></span>
96
+                    <span class="name white-text"><?php echo $userData['first_name'] . " " . $userData['last_name'] ?></span>
97 97
                   </a>
98 98
                   <a href="#">
99 99
                     <span class="email white-text"><?php echo $userData['email'] ?></span>
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                     <div class="profilepic">
127 127
                       <img style="margin-top: 40px; margin-left:55px;" src="<?php echo $userData['picture']['url'] ?>" alt="Profile Picture" class="materialboxed circle responsive-img">
128 128
                     </div>
129
-                    <p class="center teal-text" style="font-size: 25px;"><strong><?php echo $userData['first_name'] ." ". $userData['last_name'] ?></strong><p>            
129
+                    <p class="center teal-text" style="font-size: 25px;"><strong><?php echo $userData['first_name'] . " " . $userData['last_name'] ?></strong><p>            
130 130
                   <center>
131 131
                 </div>
132 132
                 <div class="col l6 profile-detaile">
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
                         </div>
174 174
                         <div class="card-content">
175 175
                           <center>
176
-                              <button type="button" rel="<?php echo $albumm['id'].','.$albumm['name'];?>" class="btn waves-effect waves-light red single-download"><i class="material-icons">get_app</i></button><br/><br/>
177
-                              <input type="checkbox"  class="select-album" value="<?php echo $albumm['id'].','.$albumm['name'];?>" class="filled-in" />
176
+                              <button type="button" rel="<?php echo $albumm['id'] . ',' . $albumm['name']; ?>" class="btn waves-effect waves-light red single-download"><i class="material-icons">get_app</i></button><br/><br/>
177
+                              <input type="checkbox"  class="select-album" value="<?php echo $albumm['id'] . ',' . $albumm['name']; ?>" class="filled-in" />
178 178
                               <br/>
179
-                              <span class="card-title"><?php echo $albumm['name'];?></span>
180
-                              <button type="button" rel="<?php echo $albumm['id'].','.$albumm['name'];?>" class="btn waves-effect waves-light blue move-single-album">Move to Drive</button>
179
+                              <span class="card-title"><?php echo $albumm['name']; ?></span>
180
+                              <button type="button" rel="<?php echo $albumm['id'] . ',' . $albumm['name']; ?>" class="btn waves-effect waves-light blue move-single-album">Move to Drive</button>
181 181
                           </center>
182 182
                         </div>
183 183
                     </div>
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     </div>
221 221
 
222 222
     <?php
223
-    $google_access_token= "";
223
+    $google_access_token = "";
224 224
     if (isset($_SESSION['google_access_token'])) {
225 225
         $google_access_token = $_SESSION['google_access_token'];
226 226
     } 
Please login to merge, or discard this patch.
slider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 if (isset($_GET['albumId'])) {
23 23
     $albumId = $_GET['albumId'];
24 24
     $response_albums = $fb->get($albumId . "/photos?fields=images,id", $accessToken);
25
-    $albums=$response_albums->getGraphEdge()->asArray(); 
26
-    $slides =""; 
25
+    $albums = $response_albums->getGraphEdge()->asArray(); 
26
+    $slides = ""; 
27 27
     foreach ($albums as $album) {
28 28
         $albumUrl = $album['images'][0]['source'];
29 29
         $slides .= '<div class="mySlides fade">';
30
-        $slides .= '<img src="'. $albumUrl .'" style="width:100%; height: 400px"></div>';
30
+        $slides .= '<img src="' . $albumUrl . '" style="width:100%; height: 400px"></div>';
31 31
     }
32 32
     echo $slides;
33 33
 }
Please login to merge, or discard this patch.
fb-callback.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
             header('Location: https://localhost:8443/SociaManager/login.php');
31 31
             exit();
32 32
         }
33
-    } catch(Facebook\Exceptions\FacebookResponseException $e) {
33
+    } catch (Facebook\Exceptions\FacebookResponseException $e) {
34 34
         // When Graph returns an error
35 35
         echo 'Graph returned an error: ' . $e->getMessage();
36 36
         exit;
37
-    } catch(Facebook\Exceptions\FacebookSDKException $e) {
37
+    } catch (Facebook\Exceptions\FacebookSDKException $e) {
38 38
         // When validation fails or other local issues
39 39
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
40 40
         exit;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     // If you know the user ID this access token belongs to, you can validate it here
52 52
     $tokenMetadata->validateExpiration();
53 53
 
54
-    if (! $accessToken->isLongLived()) {
54
+    if (!$accessToken->isLongLived()) {
55 55
         // Exchanges a short-lived access token for a long-lived one
56 56
         try {
57 57
             $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
Please login to merge, or discard this patch.