-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·76 lines (64 loc) · 1.47 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
<?php
//access the Google Users Service
use google\appengine\api\users\User;
use google\appengine\api\users\UserService;
use google\appengine\api\cloud_storage;
# Looks for current Google account session
$user = UserService::getCurrentUser();
if (!$user) {
header('Location: ' . UserService::createLoginURL($_SERVER['REQUEST_URI']));
return;
}
$userEmail = 'Hello, ' . htmlspecialchars($user->getEmail());
?>
<html>
<head>
<title>A Tree About Me - Genealogy for the Modern Family</title>
<link rel="stylesheet" type="text/css" href="styles/main.css">
</head>
<body>
<div id="container">
<div id="header">
<h2>A Tree About Me</h2>
</div>
<div id="content">
<?
//check if user has uploaded a file
$filename = 'gs://#default#/' . $user->getEmail() . '/' . "root";
if( file_exists ( $filename ) )
{
echo file_get_contents( $filename );
}
else
{
echo '<br/>File does not exist';
file_put_contents( $filename, '
{
"id": "root",
"fname":
"parents": [],
"spouse": [],
"children": [],
"level": 0
}');
}
?>
</div>
<div id="sidebar">
sidebar content here
<br/>
</div>
<div id="footer">
(c) 2015 a tree about me - amrita gupta & saumya gurbani
</div>
</div>
<div class="addnode_panel">
<br/><br/>
<a class="addnode-btn" href="#">+</a>
</div>
<div class="logout_panel">
<br/><br/>
<a class="logout-btn" href="<?php echo UserService::createLogoutUrl($_SERVER['REQUEST_URI']); ?>"><i>x</i></a>
</div>
</body>
</html>