-
Notifications
You must be signed in to change notification settings - Fork 12
/
functions.php
186 lines (158 loc) · 5.99 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
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
<?php
include("pbkdf2.php");
if($prettyurls) {
define('DEVICESURL', $baseurl."/devices");
define('RESETURL', $baseurl."/reset");
define('LOGINURL', $baseurl."/login");
define('REGISTERURL', $baseurl."/create-account");
define('PLUGINURL', $baseurl."/synccit-apps");
define('LOGOUTURL', $baseurl."/logout/@s");
define('FAQURL', $baseurl."/faq");
define('PROFILEURL', $baseurl."/profile");
define('DEVICESRMURL', $baseurl."/remove/@k/@h");
define('INDEXURL', $baseurl."/");
define('DONATEURL', $baseurl."/donate");
define('BASEURL', $baseurl."/");
} else {
define('DEVICESURL', $baseurl."/addkey.php");
define('RESETURL', $baseurl."/reset.php");
define('LOGINURL', $baseurl."/login.php");
define('REGISTERURL', $baseurl."/create.php");
define('PLUGINURL', $baseurl."/plugin.php");
define('LOGOUTURL', $baseurl."/logout.php?l=@s");
define('FAQURL', $baseurl."/faq.php");
define('PROFILEURL', $baseurl."/profile.php");
define('DEVICESRMURL', $baseurl."/addkey.php?code=@k&hash=@h&do=remove");
define('INDEXURL', $baseurl."/");
define('DONATEURL', $baseurl."/donate.php");
define('BASEURL', $baseurl."/");
}
function genrand() {
$rand = "";
for($i=0; $i<6; $i++) {
// this was posted on stack overflow
$rand .= rand(0,1) ? rand(0,9) : chr(rand(ord('a'), ord('z')));
}
return $rand;
}
// themeing
function htmlHeader($title, $loggedin=false) {
global $baseurl;
if($loggedin) {
global $session;
$key = $session->hash;
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php echo $title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- 1140px Grid styles for IE -->
<!--[if lte IE 9]><link rel="stylesheet" href="css/ie.css" type="text/css" media="screen" /><![endif]-->
<!-- The 1140px Grid - https://cssgrid.net/ -->
<link rel="stylesheet" href="css/1140.css" type="text/css" media="screen" />
<!-- Your styles -->
<link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
<!--css3-mediaqueries-js - https://code.google.com/p/css3-mediaqueries-js/ - Enables media queries in some unsupported browsers-->
<script type="text/javascript" src="js/css3-mediaqueries.js"></script>
<!--Title Font-->
<link href='https://fonts.googleapis.com/css?family=Advent+Pro:100' rel='stylesheet' type='text/css'>
<!-- body font-->
<link href='https://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
<!-- this is for the flattr button. no reason to leave it in if you aren't using it -->
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'https://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */
</script>
</head>
<body>
<div class="container">
<div class="row titlebar">
<div class="tencol">
<p class="title"><a href="<?php echo INDEXURL; ?>">synccit</a></p>
</div>
<div class="twocol last">
<div class="donate"><a href="<?php echo DONATEURL; ?>">donate</a></div>
</div>
</div>
</div>
<div class="container">
<div class="row menubar">
<?php
if($loggedin) {
?>
<div class="twocol menubaritem">
<p><a href="<?php echo PLUGINURL; ?>">Get the apps</a></p>
</div>
<div class="twocol menubaritem">
<p><a href="<?php echo DEVICESURL; ?>">Manage Devices</a></p>
</div>
<div class="twocol menubaritem">
<p><a href="<?php echo PROFILEURL; ?>">Profile</a></p>
</div>
<div class="twocol menubaritem">
<p><a href="<?php echo FAQURL; ?>">FAQ</a></p>
</div>
<div class="twocol menubaritem">
<p><a href="https://twitter.com/synccit">Twitter</a></p>
</div>
<div class="twocol menubaritem last">
<p><a href="<?php echo str_replace("@s", $key, LOGOUTURL); ?>">Logout</a></p>
</div>
<?php
} else {
?>
<div class="twocol menubaritem">
<p><a href="<?php echo PLUGINURL; ?>">Get the apps</a></p>
</div>
<div class="twocol menubaritem">
<p><a href="<?php echo FAQURL; ?>">FAQ</a></p>
</div>
<div class="twocol menubaritem">
<p><a href="https://twitter.com/synccit">Twitter</a></p>
</div>
<div class="twocol menubaritem">
<p></p>
</div>
<div class="twocol menubaritem">
<p><a href="<?php echo LOGINURL; ?>">Login</a></p>
</div>
<div class="twocol menubaritem register last">
<p><a href="<?php echo REGISTERURL; ?>">Register</a></p>
</div>
<?php
}?>
</div>
<div class="container">
<div class="row rowmain">
<?php
}
function htmlFooter() {
?>
</div>
</div>
<div class="container">
<div class="row lastrow">
<div class="fourcol">
<p class="footer footleft"><a href="https://twitter.com/synccit" target="_blank">@synccit</a> | <a href="mailto:[email protected]">[email protected]</a></p>
</div>
<div class="fourcol">
<p class="cite"></p>
</div>
<div class="fourcol last">
<p class="footer footright"><a href="https://drakeapps.com" target="_blank">Drake Apps</a> | <a href="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/drakeapps/synccit" target="_blank">Open Source</a></p>
</div>
</div>
</div>
</body>
</html><?php
}