-
Notifications
You must be signed in to change notification settings - Fork 0
/
facebookProfile.php
441 lines (411 loc) · 14.4 KB
/
facebookProfile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<!DOCTYPE html>
<html lang="en">
<head>
<title>Facebook Album</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/css/bootstrap-select.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.3/js/bootstrap-select.min.js"></script>
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //for-mobile-apps -->
<link href="node_modules/css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="style.css" rel="stylesheet" type="text/css" media="all" />
<!-- font-awesome icons -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<link href="node_modules/css/font-awesome.css" rel="stylesheet">
<script src="node_modules/js/spin.min.js"></script>
<!-- //font-awesome icons -->
<link href="//fonts.googleapis.com/css?family=Gidugu" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
</head>
<?php
include_once('siteConfig.php');
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;
use Facebook\Entities\AccessToken;
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
$google_session_token = "";
try{
if((isset($session))){
$_SESSION['login_info'] = $session;
$_SESSION['fb_token']=$session ->getToken();
$user = datafromfacebook("/me?fields=id,name,gender,email,location");
$_SESSION['user_id']= $user['id'];
$_SESSION['username']=$user['name'];
if ( isset( $_SESSION['google_session_token'] ) ) {
$google_session_token = $_SESSION['google_session_token'];
}
?>
<body>
<div class="main" id="home" style="background-image: url(images/facebook-banner.jpg)">
<!-- banner -->
<div class="banner">
<!--Slider-->
<img src="https://graph.facebook.com/<?php echo $user['id']; ?>/picture" alt=" " class="img-responsive">
<h2>Welcome, <?php echo $user['name']; ?></h2>
<span>Email : <?php
if(isset($user['email']))
echo $user['email'];
else
echo "NOT SPECIFIED";
?>
</span>
</div>
<!-- //banner -->
</div>
<!-- about -->
<div class="about" id="about">
<div class="container">
<h3 class="w3l_head">About <?php echo $user['name']; ?></h3>
<p class="w3ls_head_para">A few information about <?php echo $user['name']; ?></p>
<div class="w3l-grids-about">
<div class="col-md-12 w3ls-agile-left">
<div class="w3ls-agile-left-info">
<h4>Name</h4>
<p><?php echo $user['name']; ?></p>
</div>
<div class="w3ls-agile-left-info">
<h4>Sex</h4>
<p><?php
if(isset($user['gender']))
echo $user['gender'];
else
echo "NOT SPECIFIED";
?>
</p>
</div>
<div class="w3ls-agile-left-info">
<h4>Email Address</h4>
<p><?php
if(isset($user['email']))
echo $user['email'];
else
echo "NOT SPECIFIED";
?>
</p>
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
<!-- //about-bottom -->
<div class="w3_navigation">
<div class="container">
<nav class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse nav-wil" id="bs-example-navbar-collapse-1">
<nav class="cl-effect-1" id="cl-effect-1">
<ul class="nav navbar-nav">
<li><a href="" id="download-all-albums" class="scroll">Download All</a></li>
<li><a href="" id="download-selected-albums" class="scroll hvr-bounce-to-bottom">Download Selected Album</a></li>
<li><a href="" id="move_all" class="scroll hvr-bounce-to-bottom">Move All</a></li>
<li><a href="" id="move_selected" class="scroll hvr-bounce-to-bottom">Move Selected</a></li>
<li><a href="logout.php" id="">Logout</a></li>
</ul>
</nav>
</div>
<!-- /.navbar-collapse -->
</nav>
</div>
</div>
<!-- Album download report window -->
<div class="modal fade" id="download-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">Albums Report</h4>
</div>
<div class="modal-body" id="display-response">
<!-- Response will displayed over here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- /gallery-->
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h3 class="w3l_head"><?php echo $user['name']; ?>'s Facebook Albums</h3>
</div>
</div>
<div class="row">
<div id ="centerDiv" style="position:absolute;top:1500px;left:50%"></div>
<?php
$alb_count=0;
$albums = datafromfacebook( "/me/albums" );
if (! empty ( $albums )) {
$totalAlbum=0;
$totalImages=0;
foreach ( $albums ['data'] as $album ) {
$totalAlbum++;
$album = ( array ) $album;
$album_photo = datafromfacebook( '/' . $album ['id'] . '/photos?fields=source' );
if (! empty ( $album_photo )) {
foreach ( $album_photo ['data'] as $alb ) {
$alb = ( array ) $alb;
$totalImages++;
}
?>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="album">
<a class="dynamic" data-id="<?php echo $album['id']; ?>">
<div class="album_img" style="background-image: url(<?php echo $alb['source'];?>)"></div>
</a>
<a class="dynamic"><h3><?php echo $album['name']; ?></h3></a>
<div class="content">
<div class="action">
<div class="input-group">
<span class="input-group-addon input-sm">
<input class="select-album" type="checkbox" value="<?php echo $album['id'].','.$album['name'];?>" />
</span>
<a>
<button rel="<?php echo $album['id'].','.$album['name'];?>" class="single-download btn btn-primary btn-round">Download This Album</button>
</a>
<button class="btn btn-primary btn-round move_album" data-id="<?php echo $album['id']; ?>">Move</button>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
}?>
</div>
</div>
<!-- footer -->
<div class="w3l_footer">
<div class="container">
<div class="w3ls_footer_grids">
<div class="w3ls_footer_grid">
<div class="col-md-6 w3ls_footer_grid_left">
<div class="w3ls_footer_grid_leftl">
<i class="fas fa-address-book" aria-hidden="true"></i>
</div>
<div class="w3ls_footer_grid_leftr">
<h4>Total Albums</h4>
<h4>(<?php echo $totalAlbum?>)</h4>
</div>
<div class="clearfix"> </div>
</div>
<div class="col-md-6 w3ls_footer_grid_left">
<div class="w3ls_footer_grid_leftl">
<i class="fas fa-images" aria-hidden="true"></i>
</div>
<div class="w3ls_footer_grid_leftr">
<h4>Total Images</h4>
<h4>(<?php echo $totalImages ?>)</h4>
</div>
<div class="clearfix"> </div>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
</div>
<!-- //footer -->
<?php }
}catch ( Exception $ex ) {
echo $ex;
}?>
<script src="node_modules/js/jquery-2.2.3.min.js"></script>
<!-- js -->
<script src="node_modules/js/jquery.mobile.custom.min.js"></script>
<!-- start-smoth-scrolling -->
<script type="text/javascript" src="node_modules/js/move-top.js"></script>
<script type="text/javascript" src="node_modules/js/easing.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
});
});
</script>
<!-- start-smoth-scrolling -->
<!-- //js -->
<script src="node_modules/js/bootstrap.js"></script>
<!-- //for bootstrap working -->
<!-- here stars scrolling icon -->
<script type="text/javascript">
$(document).ready(function() {
$().UItoTop({ easingType: 'easeOutQuart' });
});
</script>
<!-- //here ends scrolling icon -->
<script type="text/javascript">
var opts = {
lines: 20 // The number of lines to draw
, length: 200 // The length of each line
, width: 33 // The line thickness
, radius: 42 // The radius of the inner circle
, scale: 100 // Scales overall size of the spinner
, corners: 1 // Corner roundness (0..1)
, color: '#3c5a99' // #rgb or #rrggbb or array of colors
, opacity: 0.25 // Opacity of the lines
, rotate: 0 // The rotation offset
, direction: 1 // 1: clockwise, -1: counterclockwise
, speed: 1 // Rounds per second
, trail: 60 // Afterglow percentage
, fps: 20 // Frames per second when using setTimeout() as a fallback for CSS
, zIndex: 2e9 // The z-index (defaults to 2000000000)
, className: 'spinner' // The CSS class to assign to the spinner
, top: '70%' // Top position relative to parent
, left: '50%' // Left position relative to parent
, shadow: false // Whether to render a shadow
, hwaccel: false // Whether to use hardware acceleration
, position: 'absolute' // Element positioning Element positioning
// Left position relative to parent
};
var target = document.getElementById('centerDiv');
function append_download_link(url) {
var spinner = new Spinner(opts).spin(target);
$.ajax({
url:url,
success:function(result){
$("#display-response").html(result);
spinner.stop();
$("#download-modal").modal({
show: true
});
}
});
}
//download all albums
$("#download-all-albums").on("click", function() {
append_download_link("downloadAlbum.php?zip=1&all_albums=all_albums");
});
//single album download
$(".single-download").on("click", function() {
var rel = $(this).attr("rel");
var album = rel.split(",");
append_download_link("downloadAlbum.php?zip=1&single_album="+album[0]+","+album[1]);
});
//get selected checkboxes
function get_all_selected_albums() {
var selected_albums;
var i = 0;
$(".select-album").each(function () {
if ($(this).is(":checked")){
if (!selected_albums) {
selected_albums = $(this).val();
} else {
selected_albums = selected_albums + "/" + $(this).val();
}
}
});
return selected_albums;
}
//download selected album
$("#download-selected-albums").on("click", function() {
var selected_albums = get_all_selected_albums();
append_download_link("downloadAlbum.php?zip=1&selected_albums="+selected_albums);
});
//move all albums to google drive
$('#move_all').click(function () {
var spinner = new Spinner(opts).spin(target);
$.ajax({
type:'POST',
url: 'moveAlbum.php',
data:{
move_all:''
},
success:function(res){
$("#display-response").html(res);
spinner.stop();
$("#download-modal").modal({
show:true
});
}
});
});
//move selected albums to google drive
$('#move_selected').click(function () {
var selected_albums = get_all_selected_albums();
var spinner = new Spinner(opts).spin(target);
$.ajax({
type:'POST',
url: 'moveAlbum.php',
data:{
albums:selected_albums,
move_selected:''
},
success:function(res){
$("#display-response").html(res);
spinner.stop();
$("#download-modal").modal({
show:true
});
}
});
});
//move single albums to google drive
$('.move_album').click(function () {
var album_id = $(this).data('id');
var spinner = new Spinner(opts).spin(target);
$.ajax({
type:'POST',
url: 'moveAlbum.php',
data:{
album_id:album_id,
move_single:''
},
success:function(res){
$("#display-response").html(res);
spinner.stop();
$("#download-modal").modal({
show:true
});
}
});
});
$('.dynamic').click(function () {
var album_id = $(this).data('id');
$.ajax({
type: 'POST',
url: 'albumSlider.php',
data: {
album_id: album_id,
photos: ''
},
success: function (res) {
var srcObj = JSON.parse(res);
$(this).lightGallery({
dynamic: true,
dynamicEl: srcObj
})
}
});
});
</script>
</body>
</html>