1<?php 2 3require_once("../inc/util_basic.inc"); 4require_once("../inc/translation.inc"); 5 6if (0) { 7 $x = $_SERVER['PHP_SELF']; 8 $path = "/tmp/php_pids/".getmypid(); 9 $f = fopen($path, "w"); 10 fwrite($f, $x); 11 fclose($f); 12} 13 14function boinc_google_search_form() { 15 echo " 16 <form method=get action=\"https://google.com/search\"> 17 <input type=hidden name=domains value=\"https://boinc.berkeley.edu\"> 18 <input type=hidden name=sitesearch value=\"https://boinc.berkeley.edu\"> 19 <span class=\"nobar\"> 20 <input class=small name=q size=20> 21 <input class=small type=submit value=".tra("Search")."> 22 </span> 23 </form> 24"; 25} 26 27function last_mod($datefile) { 28 return gmdate("g:i A \U\T\C, F d Y", filemtime($datefile)); 29} 30 31function html_tag() { 32 global $language_in_use; 33 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> 34 "; 35 36 // if language is arabic, go right to left 37 // 38 if ($language_in_use == 'ar') { 39 echo "<html dir=\"rtl\">"; 40 } else { 41 echo "<html>"; 42 } 43} 44 45function page_head($title, $extra="") { 46 global $book; 47 global $chap_num; 48 if ($book) { 49 echo "<br><h2>$chap_num. $title</h2>\n"; 50 return; 51 } 52 if (defined("CHARSET")) { 53 header("Content-type: text/html; charset=".tr(CHARSET)); 54 } 55 56 html_tag(); 57 echo " 58 <head> 59 <link rel=\"stylesheet\" type=\"text/css\" href=\"white.css\"> 60 <link rel=\"shortcut icon\" href=\"logo/favicon.gif\"> 61 <title>$title</title> 62 $extra 63 </head> 64 <body bgcolor='ffffff'> 65 <table width='100%'> 66 <tr> 67 <td><center><h1>$title</h1></center> 68 <td align=right><a href=index.php><img src=\"logo/www_logo.gif\" alt=\"BOINC logo\"></a> 69 <br> 70"; 71 boinc_google_search_form(); 72echo " 73 </td> 74 </tr></table> 75 <hr size=1> 76 "; 77} 78 79function copyright() { 80 $y = date("Y "); 81 echo " 82 Copyright © $y University of California. 83 Permission is granted to copy, distribute and/or modify this document 84 under the terms of the 85 <a href=http://www.gnu.org/copyleft/fdl.html>GNU Free Documentation License</a>, 86 Version 1.2 or any later version published by the Free Software Foundation. 87 "; 88} 89 90function page_tail($translatable=false, $is_main=false) { 91 global $book; 92 if ($book) { 93 return; 94 } 95 $datefile = $_SERVER["SCRIPT_FILENAME"]; 96 $d = last_mod($datefile); 97 echo " 98 <hr size=1> 99 "; 100 if (!$is_main) { 101 echo " 102 <center> 103 <a href=\"/\">".tra("Return to BOINC main page")."</a> 104 </center><p> 105 "; 106 } 107 echo " 108 <span class=note> 109 <font color=#888888> 110 "; 111 if ($translatable) { 112 echo 113 sprintf( 114 tra("This page is %stranslatable%s."), 115 "<a href=\"trac/wiki/TranslateIntro\">", 116 "</a>" 117 ), 118 "<br> 119 "; 120 } 121 echo " 122 Last modified $d.<br> 123 "; 124 copyright(); 125 echo " 126 </font> 127 </span> 128 </body> 129 </html> 130 "; 131} 132 133function html_text($x) { 134 return "<pre>".htmlspecialchars($x)."</pre> 135 "; 136} 137 138function list_start($attrs = 'width="100%"') { 139 echo "<p><table $attrs border=0 cellpadding=6>\n"; 140} 141 142function list_heading($x, $y, $z=null) { 143 echo " 144 <tr> 145 <th valign=top><b>$x</b></th> 146 <th valign=top>$y</th> 147"; 148 if ($z) { 149 echo " <th valign=top>$z</th>\n"; 150 } 151 echo " </tr>\n"; 152} 153 154function list_heading_array($x) { 155 echo "<tr>"; 156 foreach ($x as $h) { 157 echo "<th>$h</th>"; 158 } 159 echo "</tr>\n"; 160} 161 162function list_item($x, $y, $z=null) { 163 if (!$x) $x = "<br>"; 164 echo " 165 <tr> 166 <td class=fieldname valign=top><b>$x</b></td> 167 <td valign=top>$y</td> 168"; 169 if ($z) { 170 echo " <td valign=top>$z</a>\n"; 171 } 172 echo " </tr>\n"; 173} 174 175function list_item_array($x) { 176 echo "<tr>"; 177 foreach ($x as $h) { 178 echo "<td valign=top>$h</td>"; 179 } 180 echo "</tr>\n"; 181} 182 183function list_item_func($x, $y) { 184 list_item(html_text($x), $y); 185} 186 187function list_bar($x, $note="") { 188 if ($note) { 189 $note = "<br><span class=note>$note</span>"; 190 } 191 echo " 192 <tr><td colspan=8 class=heading><center><b>$x</b>$note</center></td></tr> 193 "; 194} 195 196function list_end() { 197 echo "</table><p>\n"; 198} 199 200function boinc_error_page($x) { 201 page_head("Error"); 202 echo $x; 203 page_tail(); 204 exit(); 205} 206 207function block_start() { 208 echo " 209 <table width=100% cellpadding=4> 210 <tr> 211 <td class=fieldname width=100%><pre>"; 212} 213 214function block_end() { 215 echo "</pre></td></tr></table> 216 "; 217} 218 219function show_link($url) { 220 echo "<br><a href=$url>$url</a>"; 221} 222 223function get_str2($x) { 224 if (array_key_exists($x, $_GET)) { 225 return $_GET[$x]; 226 } 227 return null; 228} 229 230?> 231