@@ -19,11 +19,11 @@ discard block |
||
| 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__.'/gClient.php'; |
|
| 22 | +require_once __DIR__ . '/gClient.php'; |
|
| 23 | 23 | require_once "../fb-callback.php"; |
| 24 | 24 | require_once '../LibGearman.php'; |
| 25 | 25 | |
| 26 | -$gClient =new CreateGoogleClient(); |
|
| 26 | +$gClient = new CreateGoogleClient(); |
|
| 27 | 27 | $client = $gClient->createClient(); |
| 28 | 28 | |
| 29 | 29 | if (isset($_SESSION['google_access_token'])) {
|
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | if (class_exists('GearmanClient')) {
|
| 49 | 49 | $gearman = new LibGearman(); |
| 50 | 50 | $gearman->gearman_client(); |
| 51 | - try{
|
|
| 52 | - $gearman->do_job_background('moveToDrive', serialize(['accessToken' => $_SESSION['accessToken'], 'albumId' => $single_album[0], 'albumName' => $single_album[1],'google_access_token' => $_SESSION['google_access_token'], 'parentFolderId' => $parentFolderId]));
|
|
| 51 | + try {
|
|
| 52 | + $gearman->do_job_background('moveToDrive', serialize(['accessToken' => $_SESSION['accessToken'], 'albumId' => $single_album[0], 'albumName' => $single_album[1], 'google_access_token' => $_SESSION['google_access_token'], 'parentFolderId' => $parentFolderId]));
|
|
| 53 | 53 | } catch (Exception $e) {
|
| 54 | 54 | echo "Gearman Client unable to handle request : " . $e->getMessage(); |
| 55 | 55 | } |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | if (class_exists('GearmanClient')) {
|
| 69 | 69 | $gearman = new LibGearman(); |
| 70 | 70 | $gearman->gearman_client(); |
| 71 | - try{
|
|
| 72 | - $gearman->do_job_background('moveToDrive', serialize(['accessToken' => $_SESSION['accessToken'], 'albumId' => $selected_album[0], 'albumName' => $selected_album[1],'google_access_token' => $_SESSION['google_access_token'], 'parentFolderId' => $parentFolderId]));
|
|
| 71 | + try {
|
|
| 72 | + $gearman->do_job_background('moveToDrive', serialize(['accessToken' => $_SESSION['accessToken'], 'albumId' => $selected_album[0], 'albumName' => $selected_album[1], 'google_access_token' => $_SESSION['google_access_token'], 'parentFolderId' => $parentFolderId]));
|
|
| 73 | 73 | } catch (Exception $e) {
|
| 74 | 74 | echo "Gearman Client unable to handle request : " . $e->getMessage(); |
| 75 | 75 | } |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | if (class_exists('GearmanClient')) {
|
| 95 | 95 | $gearman = new LibGearman(); |
| 96 | 96 | $gearman->gearman_client(); |
| 97 | - try{
|
|
| 98 | - $gearman->do_job_background('moveToDrive', serialize(['accessToken' => $_SESSION['accessToken'], 'albumId' => $album['id'], 'albumName' => $album['name'],'google_access_token' => $_SESSION['google_access_token'], 'parentFolderId' => $parentFolderId]));
|
|
| 97 | + try {
|
|
| 98 | + $gearman->do_job_background('moveToDrive', serialize(['accessToken' => $_SESSION['accessToken'], 'albumId' => $album['id'], 'albumName' => $album['name'], 'google_access_token' => $_SESSION['google_access_token'], 'parentFolderId' => $parentFolderId]));
|
|
| 99 | 99 | } catch (Exception $e) {
|
| 100 | 100 | echo "Gearman Client unable to handle request : " . $e->getMessage(); |
| 101 | 101 | } |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | } catch (Exception $e) {
|
| 54 | 54 | echo "Gearman Client unable to handle request : " . $e->getMessage(); |
| 55 | 55 | } |
| 56 | - } |
|
| 57 | - else {
|
|
| 56 | + } else {
|
|
| 58 | 57 | echo "Gearman Does Not Support"; |
| 59 | 58 | } |
| 60 | 59 | $response = "Your Albums Will successfully backuped with in few time!!!"; |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | } catch (Exception $e) {
|
| 74 | 73 | echo "Gearman Client unable to handle request : " . $e->getMessage(); |
| 75 | 74 | } |
| 76 | - } |
|
| 77 | - else {
|
|
| 75 | + } else {
|
|
| 78 | 76 | echo "Gearman Does Not Support"; |
| 79 | 77 | } |
| 80 | 78 | } |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | } catch (Exception $e) {
|
| 100 | 98 | echo "Gearman Client unable to handle request : " . $e->getMessage(); |
| 101 | 99 | } |
| 102 | - } |
|
| 103 | - else {
|
|
| 100 | + } else {
|
|
| 104 | 101 | echo "Gearman Does Not Support"; |
| 105 | 102 | } |
| 106 | 103 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | array('fields' => 'id') |
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | - $request_albums_photo = $fb->get($data['albumId'] ."/photos?fields=images&limit=100", $data['accessToken']); |
|
| 75 | + $request_albums_photo = $fb->get($data['albumId'] . "/photos?fields=images&limit=100", $data['accessToken']); |
|
| 76 | 76 | $arr_alb = $request_albums_photo->getGraphEdge(); |
| 77 | 77 | $i = 0; |
| 78 | 78 | $resultAlbum = self::getAlbum($fb, $arr_alb, $i); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $count = 1; |
| 81 | 81 | foreach ($resultAlbum as $images) { |
| 82 | 82 | $url = $images['images']; |
| 83 | - $img = $count.".jpeg"; |
|
| 83 | + $img = $count . ".jpeg"; |
|
| 84 | 84 | $folderId = $SubFolder->id; |
| 85 | 85 | $fileMetadata = new Google_Service_Drive_DriveFile( |
| 86 | 86 | array( |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'data' => $fileContent, 'mimeType' => 'image/jpeg', |
| 96 | 96 | 'uploadType' => 'multipart', 'fields' => 'id') |
| 97 | 97 | ); |
| 98 | - }catch (Exception $e) { |
|
| 98 | + } catch (Exception $e) { |
|
| 99 | 99 | print "An error occurred: " . $e->getMessage(); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $main_arr = array(); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public static function getAlbum($fb,$arr_alb,$i) |
|
| 107 | + public static function getAlbum($fb, $arr_alb, $i) |
|
| 108 | 108 | { |
| 109 | 109 | global $main_arr; |
| 110 | 110 | foreach ($arr_alb as $graphNode) { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $i++; |
| 113 | 113 | } |
| 114 | 114 | $arr_alb = $fb->next($arr_alb); |
| 115 | - if(!empty($arr_alb)) { |
|
| 115 | + if (!empty($arr_alb)) { |
|
| 116 | 116 | self::getAlbum($fb, $arr_alb, $i); |
| 117 | 117 | } |
| 118 | 118 | return $main_arr; |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | 'data' => $fileContent, 'mimeType' => 'image/jpeg', |
| 96 | 96 | 'uploadType' => 'multipart', 'fields' => 'id') |
| 97 | 97 | ); |
| 98 | - }catch (Exception $e) { |
|
| 98 | + } catch (Exception $e) { |
|
| 99 | 99 | print "An error occurred: " . $e->getMessage(); |
| 100 | 100 | } |
| 101 | 101 | |