-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
138 lines (134 loc) · 6.79 KB
/
index.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
<?php
$path_app=""; //defing path from app's root folder
require_once($path_app."lib/fb-config.php"); //include facebook configuration
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Albumater</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<?php
include_once($path_app.'include_files_css.php'); //include all the required css files
?>
</head>
<body>
<!-- header -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Albumater</a>
<?php
if($user)
{
?>
<span class="header-right">
<img class="profile-pic" src="https://graph.facebook.com/<?php echo $user; ?>/picture?type=large" alt="<?php echo $user_profile['name'];?>">
<a class="brand logout" href="<?php echo $path_app;?>logout.php">Logout</a>
</span>
<?php
}
?>
</div>
</div>
</div>
<!-- End of header -->
<div class="clearfix"></div>
<!-- container -->
<div class="container">
<div align="center">
<?php
if($user) //$user defined in fb-config.php file
{
?>
<script type="text/javascript">
var user=1; // define javascript varible if user is logged in and set to 1.
</script>
<p class="user-name">Hi, <?php echo $user_profile['name'];?></p> <!-- User name -->
<div id="profile_div" align="center"> </div> <!-- Here comes the cover image of user -->
<div class="download-link-div"> </div> <!-- Here comes the download link for album -->
<!-- main div which contains all the albums -->
<div class="span12 album-container">
<?php
// iterate the album array to fetch all album cover url
foreach ($user_albums['data'] as $album)
{
// generate src for album cover image
$img_src="https://graph.facebook.com/".$album['id']."/picture?type=album&access_token=".$facebook->getAccessToken();
?>
<!-- Album contaner -->
<div class="span3 span2-3 album-cover-div" align="center">
<div class="album-cover-img" align="center">
<img src='<?php echo $img_src;?>' class="album-cover" onclick="GetAlbumImages('<?php echo $album['id'];?>','<?php echo $album['count'];?>');" alt="albumimage" />
</div>
<p class="album-name">
<a onclick="GetAlbumImages('<?php echo $album['id'];?>','<?php echo $album['count'];?>');"><?php echo $album['name'];?></a>
</p>
<button id="btn_<?php echo $album['id'];?>" onclick="DownloadAlbum('<?php echo $album['id'];?>','<?php echo $album['count'];?>');" class="btn btn-primary"><i class="icon-download icon-white"></i> Download </button>
</div>
<!-- End of Album contaner -->
<?php
}
?>
</div>
<?php
}
else
{
?>
<script type="text/javascript">
var user=0; // define javascript varible if user is logged in and set to 0.
</script>
<!-- Following div contains the content when user is not logged in -->
<div class="not-connected">
<p>
Browse all your facebook albums here. They are just one click away. :D
</p>
<p>
Click <a href="<?php echo $loginUrl; ?>">here</a> to connect your <b>Facebook</b> account.
</p>
</div>
<?php
}
?>
<div class="clearfix"></div>
<hr>
</div>
<!-- Followinf div contains the "loading" content -->
<div class="loading-div">
<div class="loading-img-contanier" align="center">
<img src="<?php echo $path_app;?>images/loading.gif" alt="Loading" />
<p class="laoding-text">
Loading Album. Please Wait...
</p>
</div>
</div>
</div>
<!-- /container -->
<?php
include_once($path_app.'include_files_js.php'); //include all the required js files
?>
<script type="text/javascript">
$(document).ready(function()
{
if(user==1)
{
// get the cover image of user.
$.get('https://graph.facebook.com/<?php echo $user;?>?fields=cover&access_token=<?php echo$facebook->getAccessToken();?>',
function(data)
{
if (!data.hasOwnProperty('cover'))
$('#profile_div').css('background-color','#000');
else
$('#profile_div').css('background-image','url('+data['cover']['source']+')');
});
}
});
</script>
</body>
</html>