-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
136 lines (117 loc) · 4.24 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
<?php
session_start();
require_once('inc/adodb/adodb.inc.php');
require_once('inc/google/Google_Client.php');
require_once('inc/google/contrib/Google_CalendarService.php');
require_once('inc/google/contrib/Google_TasksService.php');
$client = new Google_Client();
$notacal = new Google_CalendarService($client);
$notatasksService = new Google_TasksService($client);
if (isset($_GET['logout'])) {
session_unset();
}
if (isset($_SESSION['access_token'])) {
$client->setAccessToken($_SESSION['access_token']);
} else {
$client->setAccessToken($client->authenticate($_GET['code']));
$_SESSION['access_token'] = $client->getAccessToken();
}
// Use index.php as a base so they can share a single access token
if(@$_GET['m'] == 'cal')
{
include('calendar_json.php');
}
elseif(@$_GET['m'] == 'task')
{
include('tasks_json.php');
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href='css/global.css' rel='stylesheet' type='text/css'>
<link href='css/weather.css' rel='stylesheet' type='text/css'>
<link href='css/tasks.css' rel='stylesheet' type='text/css'>
<link href='css/nextclass.css' rel='stylesheet' type='text/css'>
<link href='css/loader.css' rel='stylesheet' type='text/css'>
<link href='css/music.css' rel='stylesheet' type='text/css'>
<link href='css/reddit.css' rel='stylesheet' type='text/css'>
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900' rel='stylesheet' type='text/css'>
<title>Untitled Document</title>
<script type="text/javascript" src="js/scripts.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30263964-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript">
gettasks();
getnextclass();
getmusic();
getreddit();
getlocation(); //Calls weather
</script>
</head>
<body>
<div id="alerts">Loading...</div>
<?php
if(!$client->getAccessToken()) {
$authUrl = $client->createAuthUrl();
print "<a class='login' href='$authUrl'>Connect Me to access your Google Calendar and Google Tasks!</a>";
}
?>
<div id="col1">
<div class="card" id="next_class">
</div>
<div class="card" id="weather">
<div id="weather_main">
<div id="weather_main_img_stats">
<img id="weather_main_img" />
<span id="weather_img_current_cond"></span>
</div>
<div id="weather_main_stats">
<span id="weather_main_name_place"> </span>
<span id="weather_main_current_temp"></span>
<span id="weather_main_windy"> </span>
<span id="weather_main_rainy"> </span>
</div>
<br class="clr" />
</div>
<div id="weather_forecast">
<span class="forecast_day" id="day_1"></span>
<span class="forecast_day" id="day_2"></span>
<span class="forecast_day" id="day_3"></span>
<span class="forecast_day" id="day_4"></span>
<br class="clr" />
</div>
</div>
</div>
<div id="col2" class="">
<div class="card" id="tasks">
<span class="header_tasks">Assignments</span>
<ul id="assignments">
</ul>
</div>
<div class="card" id="music_player">
</div>
<div class="card" id="reddit">
<a class="mail_none" href="http://www.reddit.com/message/inbox/" target="_blank"></a>
<span class="username">fodawim</span>
<span class="karma">999,999 • 999,999</span>
<div class="clr"></div>
</div>
</div>
</body>
</html>
<?php
}