-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
69 lines (56 loc) · 1.19 KB
/
functions.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
<?php
require('facebook-php-sdk/src/facebook.php');
require('config.php');
// Get the Facebook object
function getFacebookObject()
{
$facebook = new Facebook(array(
'appId' => FACEBOOK_APP_ID,
'secret' => FACEBOOK_APP_SECRET));
return $facebook;
}
// Get the active facebook user using the PHP API
function getFacebookUser()
{
$facebook = getFacebookObject();
return $facebook->getUser();
}
// Redirect if the user isn't logged in
function redirectIfNotLoggedIn($facebook)
{
$user = $facebook->getUser();
if($user == 0)
login($facebook);
}
// Redirects to the Facebook login
function login($facebook)
{
header('Location: ' . $facebook->getLoginUrl(array('scope' => FACEBOOK_SCOPE)));
}
// Debug logging
function d($message)
{
error_log(date('n/j/y g:i:s A') . ': ' . $message . "\n", 3, LOG_FILE);
}
// Writes the HTML for a step
function makeStep($title, $desc, $id)
{
?>
<div class="sidebarStep" id="<?php echo $id ?>">
<div class="stepTitle">
<h3>
<span class="stepSelector hide">
»
</span>
<span class="stepTitleText">
<?php echo $title ?>
</span>
</h3>
</div>
<div class="stepDesc">
<p><?php echo $desc ?></p>
</div>
</div>
<hr>
<?
}