-
Notifications
You must be signed in to change notification settings - Fork 9
/
docutil.php
237 lines (212 loc) · 5.05 KB
/
docutil.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
<?php
require_once("../inc/util_basic.inc");
require_once("../inc/translation.inc");
if (0) {
$x = $_SERVER['PHP_SELF'];
$path = "/tmp/php_pids/".getmypid();
$f = fopen($path, "w");
fwrite($f, $x);
fclose($f);
}
function boinc_google_search_form() {
echo "
<form method=get action=\"https://google.com/search\">
<input type=hidden name=domains value=\"https://boinc.berkeley.edu\">
<input type=hidden name=sitesearch value=\"https://boinc.berkeley.edu\">
<span class=\"nobar\">
<input class=small name=q size=20>
<input class=small type=submit value=".tra("Search").">
</span>
</form>
";
}
function last_mod($datefile) {
return gmdate("g:i A \U\T\C, F d Y", filemtime($datefile));
}
function html_tag() {
global $language_in_use;
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
";
// if language is arabic, go right to left
//
if ($language_in_use == 'ar') {
echo "<html dir=\"rtl\">";
} else {
echo "<html>";
}
}
// old page head, doesn't do login/navbar stuff
//
function old_page_head($title, $extra="") {
global $book;
global $chap_num;
if ($book) {
echo "<br><h2>$chap_num. $title</h2>\n";
return;
}
if (defined("CHARSET")) {
header("Content-type: text/html; charset=".tr(CHARSET));
}
html_tag();
echo "
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap.min.css\">
<link rel=\"shortcut icon\" href=\"logo/favicon.gif\">
<title>$title</title>
$extra
</head>
<body>
";
echo '<div class="container-fluid">
';
echo "
<table width='100%'>
<tr>
<td><center><h1>$title</h1></center>
<td align=right><a href=index.php><img src=\"logo/www_logo.gif\" alt=\"BOINC logo\"></a>
<br>
";
boinc_google_search_form();
echo "
</td>
</tr></table>
<hr size=1>
";
}
function copyright() {
$y = date("Y ");
echo "
Copyright © $y University of California.
Permission is granted to copy, distribute and/or modify this document
under the terms of the
<a href=http://www.gnu.org/copyleft/fdl.html>GNU Free Documentation License</a>,
Version 1.2 or any later version published by the Free Software Foundation.
";
}
function old_page_tail($translatable=false, $is_main=false) {
global $book;
if ($book) {
return;
}
$datefile = $_SERVER["SCRIPT_FILENAME"];
$d = last_mod($datefile);
echo "
<hr size=1>
";
if (!$is_main) {
echo "
<center>
<a href=\"/\">".tra("Return to BOINC main page")."</a>
</center><p>
";
}
echo "
<span class=note>
<font color=#888888>
";
if ($translatable) {
echo
sprintf(
tra("This page is %stranslatable%s."),
"<a href=\"https://github.com/BOINC/boinc/wiki/TranslateIntro\">",
"</a>"
),
"<br>
";
}
echo "
Last modified $d.<br>
";
copyright();
echo "
</font>
</span>
</div>
</body>
</html>
";
}
function html_text($x) {
return "<pre>".htmlspecialchars($x)."</pre>
";
}
function list_start($attrs = 'width="100%"') {
echo "<p><table $attrs border=0 cellpadding=6>\n";
}
function list_heading($x, $y, $z=null) {
echo "
<tr>
<th valign=top><b>$x</b></th>
<th valign=top>$y</th>
";
if ($z) {
echo " <th valign=top>$z</th>\n";
}
echo " </tr>\n";
}
function list_heading_array($x) {
echo "<tr>";
foreach ($x as $h) {
echo "<th>$h</th>";
}
echo "</tr>\n";
}
function list_item($x, $y, $z=null) {
if (!$x) $x = "<br>";
echo "
<tr>
<td class=fieldname valign=top><b>$x</b></td>
<td valign=top>$y</td>
";
if ($z) {
echo " <td valign=top>$z</a>\n";
}
echo " </tr>\n";
}
function list_item_array($x) {
echo "<tr>";
foreach ($x as $h) {
echo "<td valign=top>$h</td>";
}
echo "</tr>\n";
}
function list_item_func($x, $y) {
list_item(html_text($x), $y);
}
function list_bar($x, $note="") {
if ($note) {
$note = "<br><span class=note>$note</span>";
}
echo "
<tr><td colspan=8 class=heading><center><b>$x</b>$note</center></td></tr>
";
}
function list_end() {
echo "</table><p>\n";
}
function boinc_error_page($x) {
old_page_head("Error");
echo $x;
old_page_tail();
exit();
}
function block_start() {
echo "
<table width=100% cellpadding=4>
<tr>
<td class=fieldname width=100%><pre>";
}
function block_end() {
echo "</pre></td></tr></table>
";
}
function show_link($url) {
echo "<br><a href=$url>$url</a>";
}
function get_str2($x) {
if (array_key_exists($x, $_GET)) {
return $_GET[$x];
}
return null;
}
?>