@@ -18,7 +18,7 @@ |
||
| 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 |
@@ -30,11 +30,11 @@ discard block |
||
| 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 |
||
| 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); |
@@ -17,7 +17,7 @@ |
||
| 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://localhost:8443/SociaManager/index.php');
|
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | header('Location: https://localhost:8443/SociaManager/index.php');
|
| 24 | 24 | exit(); |
| 25 | 25 | } |
| 26 | -$permissions = ['email','user_photos']; |
|
| 26 | +$permissions = ['email', 'user_photos']; |
|
| 27 | 27 | $loginUrl = $helper->getLoginUrl( |
| 28 | 28 | 'https://localhost:8443/SociaManager/index.php', |
| 29 | 29 | $permissions |
@@ -122,7 +122,7 @@ discard block |
||
| 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,9 +166,9 @@ discard block |
||
| 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 | |
| 171 | - $folder = dirname($_SERVER['PHP_SELF']).'/'.$album_download_directory; |
|
| 171 | + $folder = dirname($_SERVER['PHP_SELF']) . '/' . $album_download_directory; |
|
| 172 | 172 | // Server Root |
| 173 | 173 | $root = $_SERVER["DOCUMENT_ROOT"]; |
| 174 | 174 | // source of the folder to unpack |
@@ -45,8 +45,9 @@ |
||
| 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 | if (is_dir($file) === true) {
|
| 51 | 52 | $a[] = array( |
| 52 | 53 | 'type' => 'dir', |
@@ -245,7 +245,12 @@ |
||
| 245 | 245 | } |
| 246 | 246 | ?> |
| 247 | 247 | |
| 248 | - <div id="" class="g-access-token"><?php if ($google_access_token) echo "Hello"; else echo ""; ?></div> |
|
| 248 | + <div id="" class="g-access-token"><?php if ($google_access_token) {
|
|
| 249 | + echo "Hello"; |
|
| 250 | +} else {
|
|
| 251 | + echo ""; |
|
| 252 | +} |
|
| 253 | +?></div> |
|
| 249 | 254 | |
| 250 | 255 | <!-- Footer --> |
| 251 | 256 | |
@@ -24,7 +24,7 @@ discard block |
||
| 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> |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | <img src="<?php echo $userData['picture']['url'] ?>" alt="Profile Picture" class="circle"> |
| 95 | 95 | </a> |
| 96 | 96 | <a href="#"> |
| 97 | - <span class="name white-text"><?php echo $userData['first_name'] ." ".$userData['last_name'] ?></span> |
|
| 97 | + <span class="name white-text"><?php echo $userData['first_name'] . " " . $userData['last_name'] ?></span> |
|
| 98 | 98 | </a> |
| 99 | 99 | <a href="#"> |
| 100 | 100 | <span class="email white-text"><?php echo $userData['email'] ?></span> |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | <div class="profilepic"> |
| 128 | 128 | <img style="margin-top: 100px;" height="100" width="100" src="<?php echo $userData['picture']['url'] ?>" alt="Profile Picture" class="materialboxed circle responsive-img"> |
| 129 | 129 | </div> |
| 130 | - <p class="center teal-text" style="font-size: 25px;"><strong><?php echo $userData['first_name'] ." ". $userData['last_name'] ?></strong><p> |
|
| 130 | + <p class="center teal-text" style="font-size: 25px;"><strong><?php echo $userData['first_name'] . " " . $userData['last_name'] ?></strong><p> |
|
| 131 | 131 | <center> |
| 132 | 132 | </div> |
| 133 | 133 | <div class="col l6 profile-detaile"> |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | </div> |
| 182 | 182 | <div class="card-content"> |
| 183 | 183 | <center> |
| 184 | - <span class="card-title"><?php echo $albumm['name'];?></span> |
|
| 185 | - <input type="checkbox" class="select-album" value="<?php echo $albumm['id'].','.$albumm['name'];?>" class="filled-in" /><br/> |
|
| 186 | - <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/> |
|
| 187 | - <button type="button" rel="<?php echo $albumm['id'].','.$albumm['name'];?>" class="btn waves-effect waves-light single-export">Export Album</button><br/><br/> |
|
| 184 | + <span class="card-title"><?php echo $albumm['name']; ?></span> |
|
| 185 | + <input type="checkbox" class="select-album" value="<?php echo $albumm['id'] . ',' . $albumm['name']; ?>" class="filled-in" /><br/> |
|
| 186 | + <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/> |
|
| 187 | + <button type="button" rel="<?php echo $albumm['id'] . ',' . $albumm['name']; ?>" class="btn waves-effect waves-light single-export">Export Album</button><br/><br/> |
|
| 188 | 188 | |
| 189 | - <button type="button" rel="<?php echo $albumm['id'].','.$albumm['name'];?>" class="btn waves-effect waves-light blue move-single-album">Move to Drive</button> |
|
| 189 | + <button type="button" rel="<?php echo $albumm['id'] . ',' . $albumm['name']; ?>" class="btn waves-effect waves-light blue move-single-album">Move to Drive</button> |
|
| 190 | 190 | </center> |
| 191 | 191 | </div> |
| 192 | 192 | </div> |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | </div> |
| 229 | 229 | |
| 230 | 230 | <?php |
| 231 | - $google_access_token= ""; |
|
| 231 | + $google_access_token = ""; |
|
| 232 | 232 | if (isset($_SESSION['google_access_token'])) {
|
| 233 | 233 | $google_access_token = $_SESSION['google_access_token']; |
| 234 | 234 | } |
@@ -19,7 +19,7 @@ |
||
| 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 | 25 | if (!isset($_GET['code'])) {
|
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | global $main_arr; |
| 48 | 48 | $album_directory = $album_download_directory.$album_name; |
| 49 | 49 | if (!file_exists($album_directory)) {
|
| 50 | - @mkdir($album_directory, 0777) || exit("Coudn't able to create directory");
|
|
| 50 | + @mkdir($album_directory, 0777) || exit("Coudn't able to create directory");
|
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $request_albums_photo = $fb->get($album_id . "/photos?fields=images&limit=100", $accessToken); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $fb |
| 46 | 46 | ) {
|
| 47 | 47 | global $main_arr; |
| 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) || exit("Coudn't able to create directory");
|
| 51 | 51 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | ); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | -function zipFolder($album_download_directory){
|
|
| 180 | +function zipFolder($album_download_directory) {
|
|
| 181 | 181 | if (isset($_GET['zip'])) {
|
| 182 | 182 | include_once 'zipper.php'; |
| 183 | 183 | $zipper = new Zipper(); |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | 404 => 'Not Found', |
| 6 | 6 | 500 => 'Internal Server Error' |
| 7 | 7 | ); |
| 8 | - $source_url = 'http'.((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 's' : '').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 8 | + $source_url = 'http' . ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 9 | 9 | if (array_key_exists($code, $codes) && is_numeric($code)) { |
| 10 | 10 | $error_code = $code; |
| 11 | 11 | $error_name = $codes[$code]; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | <table border="0" cellpadding="0" cellspacing="0"> |
| 311 | 311 | <tbody> |
| 312 | 312 | <tr> |
| 313 | - <td> <a href="https://rtfbchallenge.tk/'.$user_album.'.zip" target="_blank">Download Albums</a> </td> |
|
| 313 | + <td> <a href="https://rtfbchallenge.tk/'.$user_album . '.zip" target="_blank">Download Albums</a> </td> |
|
| 314 | 314 | </tr> |
| 315 | 315 | </tbody> |
| 316 | 316 | </table> |
@@ -339,24 +339,24 @@ discard block |
||
| 339 | 339 | </html> |
| 340 | 340 | '; |
| 341 | 341 | |
| 342 | - $mail = new PHPMailer(true); // Passing `true` enables exceptions |
|
| 342 | + $mail = new PHPMailer(true); // Passing `true` enables exceptions |
|
| 343 | 343 | try { |
| 344 | 344 | //Server settings |
| 345 | - $mail->SMTPDebug = 0; // Enable verbose debug output |
|
| 346 | - $mail->isSMTP(); // Set mailer to use SMTP |
|
| 347 | - $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers |
|
| 348 | - $mail->SMTPAuth = true; // Enable SMTP authentication |
|
| 349 | - $mail->Username = '[email protected]'; // SMTP username |
|
| 350 | - $mail->Password = 'Your Password'; // SMTP password |
|
| 351 | - $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted |
|
| 352 | - $mail->Port = 465; // TCP port to connect to |
|
| 345 | + $mail->SMTPDebug = 0; // Enable verbose debug output |
|
| 346 | + $mail->isSMTP(); // Set mailer to use SMTP |
|
| 347 | + $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers |
|
| 348 | + $mail->SMTPAuth = true; // Enable SMTP authentication |
|
| 349 | + $mail->Username = '[email protected]'; // SMTP username |
|
| 350 | + $mail->Password = 'Your Password'; // SMTP password |
|
| 351 | + $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted |
|
| 352 | + $mail->Port = 465; // TCP port to connect to |
|
| 353 | 353 | |
| 354 | 354 | //Recipients |
| 355 | 355 | $mail->setFrom($user_email, 'Any name(Optional)'); |
| 356 | - $mail->addAddress($user_email, $user_name); // Add a recipient |
|
| 356 | + $mail->addAddress($user_email, $user_name); // Add a recipient |
|
| 357 | 357 | |
| 358 | 358 | //Content |
| 359 | - $mail->isHTML(true); // Set email format to HTML |
|
| 359 | + $mail->isHTML(true); // Set email format to HTML |
|
| 360 | 360 | $mail->Subject = '[Social Manager] Album Download Link'; |
| 361 | 361 | $mail->Body = $mail_body; |
| 362 | 362 | $mail->send(); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } catch (Exception $e) { |
| 366 | 366 | echo 'Email could not be sent. Mailer Error: ', $mail->ErrorInfo; |
| 367 | 367 | } |
| 368 | -}else { |
|
| 368 | +} else { |
|
| 369 | 369 | echo "Email id is not provided Or Downloading failed"; |
| 370 | 370 | } |
| 371 | 371 | ?> |
| 372 | 372 | \ No newline at end of file |
@@ -365,7 +365,7 @@ |
||
| 365 | 365 | } catch (Exception $e) { |
| 366 | 366 | echo 'Email could not be sent. Mailer Error: ', $mail->ErrorInfo; |
| 367 | 367 | } |
| 368 | -}else { |
|
| 368 | +} else { |
|
| 369 | 369 | echo "Email id is not provided Or Downloading failed"; |
| 370 | 370 | } |
| 371 | 371 | ?> |
| 372 | 372 | \ No newline at end of file |