-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
286 lines (253 loc) · 12.5 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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<?php
$MY_ENV = array();
$MY_ENV['complete'] = "yes"; // assume the best: we got all what we need in the form
$MY_ENV['message'] = ""; // empty to start with, might become an error message later, used in form
$MY_ENV['date'] = date('j. F Y');
/*
* Load default values.
* If the file preset.php exists in the same dir as this file,
* it will be loaded and can be used to populate the form.
* See preset.php.empty for the structure.
*/
if(file_exists("preset.php")) {
include("preset.php");
}
// URL shown on screencast page
$MY_ENV['wwwurl']['airtime'] = "www.airtime.pro";
$MY_ENV['wwwurl']['booktype'] = "www.booktype.pro";
$MY_ENV['wwwurl']['omnibook'] = "www.omnibook.pro";
$MY_ENV['wwwurl']['newscoop'] = "www.sourcefabric.org";
$MY_ENV['wwwurl']['superdesk'] = "www.superdesk.org";
$MY_ENV['wwwurl']['screencast'] = "www.sourcefabric.org";
$MY_ENV['wwwurl']['sourcefabric'] = "www.sourcefabric.org";
if (isset($_POST['title'])) { $MY_ENV['title'] = stripslashes($_POST['title']); }
if (isset($_POST['description'])) { $MY_ENV['description'] = stripslashes($_POST['description']);}
if (isset($_POST['project'])) { $MY_ENV['project'] = stripslashes($_POST['project']);}
if (isset($_POST['version'])) { $MY_ENV['version'] = stripslashes($_POST['version']);}
if (isset($_POST['target'])) { $MY_ENV['target'] = stripslashes($_POST['target']);}
if (isset($_POST['name'])) { $MY_ENV['name'] = stripslashes($_POST['name']);}
if (isset($_POST['email'])) { $MY_ENV['email'] = stripslashes($_POST['email']);}
if (isset($_POST['date'])) { $MY_ENV['date'] = stripslashes($_POST['date']);}
if (isset($_POST['language'])) { $MY_ENV['language'] = stripslashes($_POST['language']);}
if (isset($_POST['imgurl'])) { $MY_ENV['imgurl'] = trim(stripslashes($_POST['imgurl']));}
// check if all information filled out
if (empty($MY_ENV['language'])) { $MY_ENV['complete'] = "language"; } // we didn't get this variable, ask for it later
if (empty($MY_ENV['name'])) { $MY_ENV['complete'] = "name"; } // we didn't get this variable, ask for it later
// if (empty($MY_ENV['version'])) { $MY_ENV['complete'] = "version"; } // we didn't get this variable, ask for it later
if (empty($MY_ENV['description'])) { $MY_ENV['complete'] = "description"; } // we didn't get this variable, ask for it later
if (empty($MY_ENV['title'])) { $MY_ENV['complete'] = "title"; } // we didn't get this variable, ask for it later
// if (empty($MY_ENV['email'])) { $MY_ENV['complete'] = "email"; } // we didn't get this variable, ask for it later
// language
$l = "en";
if (isset($_POST['l'])) { $l = $_POST['l']; }
if (isset($_GET['l'])) { $l = $_GET['l']; }
// reading lang from config, read english as default
$lang = array();
include 'lang-en.php';
if(file_exists("lang-".$l.".php")) {
include "lang-".$l.".php";
}
// creating error message, only after posting data ( isset($MY_ENV['title']) )
if (isset($MY_ENV['title']) && $MY_ENV['complete'] != "yes") {
$MY_ENV['message'] = "<div class='error'>".$lang['errorform']."</div>";
// creating errors for form display
if (empty($MY_ENV['language'])) { $MY_ENV['error']['language'] = "error"; }
if (empty($MY_ENV['name'])) { $MY_ENV['error']['name'] = "error"; }
if (empty($MY_ENV['description'])) { $MY_ENV['error']['description'] = "error"; }
if (empty($MY_ENV['title'])) { $MY_ENV['error']['title'] = "error"; }
}
// collecting "selected" information for pulldowns and language choice in form
// this is an awkward way of doing this. I am a bit embarrassed about it. But no time to fix it.
if ($MY_ENV['project'] == "airtime") { $MY_ENV['selected']['projairtime'] = " SELECTED"; }
if ($MY_ENV['project'] == "booktype") { $MY_ENV['selected']['projbooktype'] = " SELECTED"; }
if ($MY_ENV['project'] == "omnibook") { $MY_ENV['selected']['projomnibook'] = " SELECTED"; }
if ($MY_ENV['project'] == "newscoop") { $MY_ENV['selected']['projnewscoop'] = " SELECTED"; }
if ($MY_ENV['project'] == "superdesk") { $MY_ENV['selected']['projsuperdesk'] = " SELECTED"; }
if ($MY_ENV['project'] == "screencast") { $MY_ENV['selected']['projscreencast'] = " SELECTED"; }
if ($MY_ENV['project'] == "sourcefabric") { $MY_ENV['selected']['projsourcefabric'] = " SELECTED"; }
if ($MY_ENV['target'] == "editors") { $MY_ENV['selected']['targeditors'] = " SELECTED"; }
if ($MY_ENV['target'] == "authors") { $MY_ENV['selected']['targauthors'] = " SELECTED"; }
if ($MY_ENV['target'] == "template") { $MY_ENV['selected']['targtemplate'] = " SELECTED"; }
if ($MY_ENV['target'] == "administration") { $MY_ENV['selected']['targadministration'] = " SELECTED"; }
if ($MY_ENV['target'] == "trainer") { $MY_ENV['selected']['targtrainer'] = " SELECTED"; }
if ($MY_ENV['target'] == "screencaster") { $MY_ENV['selected']['targscreencaster'] = " SELECTED"; }
if ($l == "en") { $MY_ENV['selected']['langen'] = "selected"; }
if ($l == "cz") { $MY_ENV['selected']['langcz'] = "selected"; }
if ($l == "de") { $MY_ENV['selected']['langde'] = "selected"; }
if ($l == "es") { $MY_ENV['selected']['langes'] = "selected"; }
if ($l == "pl") { $MY_ENV['selected']['langpl'] = "selected"; }
if ($l == "ru") { $MY_ENV['selected']['langru'] = "selected"; }
// adding image if URL sent
if(trim($MY_ENV['imgurl']) != "") { $MY_ENV['htmlimgurl'] = "<figure><img src=\"".$MY_ENV['imgurl']."\"></figure>"; }
$html_head = html_head();
print $html_head;
if ($MY_ENV['complete'] != "yes") {
$html_body = html_form();
} else {
$html_body = html_page();
}
print $html_body;
function html_head() {
return "
<!DOCTYPE html>
<html>
<head>
<meta charset=\"utf-8\">
<title>Screencast</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|Roboto+Slab:400,100,700&subset=latin,greek,greek-ext,vietnamese,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css'>
<link rel=\"stylesheet\" type=\"text/css\" href=\"css/main.css\">
</head>";
} // end function html_head()
function html_form() {
global $lang;
global $MY_ENV;
$return = "";
$return .= "<body>
<div class=\"wrapper\">
<div class=\"content\">
<div class=\"title\">
<h2>".$lang['pagetitle']."</h2>
</div>
".$MY_ENV['message']."
<div class=\"language\">
<p>".$lang['langselect']."</p>
<ul>
<li class=\"".$MY_ENV['selected']['langen']."\"><a href=\"index.php\" class=\"langen\">english</a></li>
<li class=\"".$MY_ENV['selected']['langcz']."\"><a href=\"index.php?l=cz\" class=\"langcz\">czech</a></li>
<li class=\"".$MY_ENV['selected']['langes']."\"><a href=\"index.php?l=es\" class=\"langes\">spanish</a></li>
<li class=\"".$MY_ENV['selected']['langru']."\"><a href=\"index.php?l=ru\" class=\"langru\">russian</a></li>
<li class=\"".$MY_ENV['selected']['langpl']."\"><a href=\"index.php?l=pl\" class=\"langpl\">polish</a></li>
<li class=\"".$MY_ENV['selected']['langde']."\"><a href=\"index.php?l=de\" class=\"langde\">german</a></li>
</ul>
</div>
<form action=\"".$PHP_SELF."\" method=\"post\">
<div class=\"formitem\">
<label for=\"title\" class=\"".$MY_ENV['error']['title']."\">".$lang['title']."</label>
<input name=\"title\" class=\"formlong\" value=\"".$MY_ENV['title']."\">
</div>
<div class=\"formitem\">
<label for=\"description\" class=\"".$MY_ENV['error']['description']."\">".$lang['description']."</label>
<input name=\"description\" class=\"formlong\" value=\"".$MY_ENV['description']."\">
</div>
<div class=\"formitem\">
<label for=\"project\">".$lang['project']."</label>
<select name=\"project\">
<option value=\"airtime\"".$MY_ENV['selected']['projairtime'].">Airtime</option>
<option value=\"booktype\"".$MY_ENV['selected']['projbooktype'].">Booktype</option>
<option value=\"omnibook\"".$MY_ENV['selected']['projomnibook'].">Omnibook</option>
<option value=\"newscoop\"".$MY_ENV['selected']['projnewscoop'].">Newscoop</option>
<option value=\"superdesk\"".$MY_ENV['selected']['projsuperdesk'].">Superdesk</option>
<option value=\"screencast\"".$MY_ENV['selected']['projscreencast'].">Screencast</option>
<option value=\"sourcefabric\"".$MY_ENV['selected']['projsourcefabric'].">Sourcefabric</option>
</select>
</div>
<div class=\"formitem\">
<label for=\"version\">".$lang['version']."</label>
<input name=\"version\" class=\"formshort\" value=\"".$MY_ENV['version']."\">
</div>
<div class=\"formitem\">
<label for=\"imgurl\">".$lang['imgurl']."</label>
<input name=\"imgurl\" class=\"formlong\" value=\"".$MY_ENV['imgurl']."\">
<!--input type=\"file\" name=\"imgurl\" accept=\"image/*\"-->
</div>
<div class=\"formitem\">
<label for=\"name\" class=\"".$MY_ENV['error']['name']."\">".$lang['name']."</label>
<input name=\"name\" class=\"formlong\" value=\"".$MY_ENV['name']."\">
</div>
<div class=\"formitem\">
<label for=\"email\">".$lang['email']."</label>
<input name=\"email\" class=\"formlong\" value=\"".$MY_ENV['email']."\">
</div>
<div class=\"formitem\">
<label for=\"date\">".$lang['date']."</label>
<input name=\"date\" class=\"formshort\" value=\"".$MY_ENV['date']."\">
</div>
<div class=\"formitem\">
<label for=\"target\">".$lang['target']."</label>
<select name=\"target\">
<option value=\"editors\"".$MY_ENV['selected']['targeditors'].">".$lang['editors']."</option>
<option value=\"authors\"".$MY_ENV['selected']['targauthors'].">".$lang['authors']."</option>
<option value=\"template\"".$MY_ENV['selected']['targtemplate'].">".$lang['template']."</option>
<option value=\"administration\"".$MY_ENV['selected']['targadministration'].">".$lang['administration']."</option>
<option value=\"trainer\"".$MY_ENV['selected']['targtrainer'].">".$lang['trainer']."</option>
<option value=\"screencaster\"".$MY_ENV['selected']['targscreencaster'].">".$lang['screencaster']."</option>
</select>
</div>
<div class=\"formitem\">
<label for=\"language\" class=\"".$MY_ENV['error']['language']."\">".$lang['language']."</label>
<input name=\"language\" class=\"formshort\" value=\"".$MY_ENV['language']."\">
</div>
<br>
<div class=\"formitem\">
<input type=\"submit\" value=\"".$lang['submit']."\">
<input type=\"reset\" value=\"".$lang['reset']."\">
</div>
<br>
<p>
".$lang['sharethis']."<br>
".$lang['feature'].": <a href=\"mailto:contact@sourcefabric.org\">contact@sourcefabric.org</a> |
<a href=\"http://www.sourcefabric.org\" target=\"_blank\">www.sourcefabric.org</a>
</p>
</form>
<div class=\"colors\">
<span class=\"orange\"> </span>
<span class=\"blue\"> </span>
<span class=\"green\"> </span>
<span class=\"purple\"> </span>
<span class=\"yellow\"> </span>
</div>
</div>
</div>
</body>
</html>";
return $return;
} // end function html_form()
function html_page() {
global $MY_ENV;
global $lang;
$return = "";
$return .= "
<body class=".$MY_ENV['project'].">
<div class=\"wrapper ".$MY_ENV['project']."\">
<div class=\"content\">
<div class=\"title\">
<h1>".$MY_ENV['title']."</h1>
<p> </p>
<h2>".$MY_ENV['description']."</h2>
</div>
<div class=\"author\">
".$MY_ENV['htmlimgurl']."
<p class=\"name\">".$MY_ENV['name']."</p>
<p class=\"email\">".$MY_ENV['email']." </p>
</div>
<div class=\"info\">
<p><span>".$MY_ENV['date']."</span><span>".$lang[$MY_ENV['target']]."</span><span>".$lang['language'].": ".$MY_ENV['language']."</span></p>
<p>".$MY_ENV['wwwurl'][$MY_ENV['project']]."</p>
</div>
</div>
</div><!-- /wrapper -->
<div class=\"footerwrapper ".$MY_ENV['project']."\">
<footer>
<p class=\"version\"><span>".ucfirst($MY_ENV['project'])."</span>";
if(trim($MY_ENV['version']) != "") {
$return .= " <span>".$lang['version']." ".$MY_ENV['version']."</span>";
}
$return .= "
</p>";
if(file_exists("img/".$MY_ENV['project']."_logo.png")) {
$return .= " <img src=\"img/".$MY_ENV['project']."_logo.png\">";
}
$return .= " <div class=\"colors\">
<span class=\"orange\"> </span>
<span class=\"blue\"> </span>
<span class=\"green\"> </span>
<span class=\"purple\"> </span>
<span class=\"yellow\"> </span>
</div>
</footer>
</div><!-- /wrapper -->
</body>
</html>";
return $return;
} // end function html_page()
?>