Path: blob/main/website/content/en/cgi/cgi-style.pl
18093 views
#1# Perl routines to encapsulate various elements of HTML page style.23# For future reference, when is now?4($se,$mn,$hr,$md,$mo,$yr,$wd,$yd,$dst) = localtime(time);5$yr += 1900;6$mo += 1;7$timestamp = "$mo-$md-$yr";89if (!defined($hsty_base)) {10# $hsty_base should be relative if possible, so that mirrors11# serve their local copy instead of going to the main site.12# However, if we aren't running as a cgi, or if we're13# running on one of the subdomains listed below, use the absolute home path.14if (!defined($ENV{'HTTP_HOST'}) ||15$ENV{'HTTP_HOST'} =~ /(docs|docs-archive|mail-archive|man|man-dev|people|ports).freebsd.org/i) {1617$hsty_base = 'https://www.FreeBSD.org'18} else {19$hsty_base = '..';20}21}22if (!defined($hsty_email)) {23$hsty_email = 'Contact';24}25if (!defined($hsty_author)) {26$hsty_author = "<a href='$hsty_base/mailto/'>$hsty_email</a>";27}2829if (!defined($hsty_date)) {30$hsty_date = '';31}3233if (!defined($hsty_charset)) {34$hsty_charset = 'iso-8859-1';35}3637# This can be set to either a string containing an inline CSS stylesheet38# or to a <link> element that references an external CSS stylesheet, to39# make local modifications to the style of a CGI script's output.40$t_style = ""; # Don't allow script to override completely, just41# let the script's setting cascade with the master.4243$i_topbar = qq`44<div id="containerwrap">45<div id="container">46<span class="txtoffscreen"><a href="#content"47title="Skip site navigation" accesskey="1">Skip site48navigation</a> (1)</span><span class="txtoffscreen"><a49href="#content" title="Skip section navigation"50accesskey="2">Skip section navigation</a> (2)</span>5152<div id="headercontainer">53<div id="header">54<h2 class="blockhide">Header And Logo</h2>5556<div id="headerlogoleft">57<a href="$hsty_base" title="FreeBSD"><img58src="$hsty_base/layout/images/banner-red.png" width="457"59height="75" alt="FreeBSD" /></a>60</div>6162<div id="headerlogoright">63<h2 class="blockhide">Peripheral Links</h2>6465<div class="frontdonateroundbox">66<div class="frontdonatetop">67<div>68<b style="display: none;">.</b>69</div>70</div>71<div class="frontdonatecontent">72<a href="https://www.FreeBSDFoundation.org/donate/">Donate to FreeBSD</a>73</div>74<div class="frontdonatebot">75<div>76<b style="display: none;">.</b>77</div>78</div>79</div>8081<div id="search">82<form method="get" id="search-form" action="https://duckduckgo.com/">83<h2 class="blockhide"><label for="words">Search</label></h2>84<input type="hidden" name="sites" value="FreeBSD.org" />85<input type="hidden" name="ka" value="v" />86<input type="hidden" name="kt" value="v" />87<input type="hidden" name="kh" value="1" />88<input type="hidden" name="kj" value="r2" />89<input id="words" name="q" type="text" size="20"90autocapitalize="none"91maxlength="255"92onfocus="if( this.value==this.defaultValue ) this.value='';"93value="Search" />94<span> </span>95<input id="submit" name="submit" type="submit" value="Search" />96</form>97</div>98</div>99</div>100101<h2 class="blockhide">Site Navigation</h2>102103<div id="menu">104<ul class="first">105<li><a href="$hsty_base/">Home</a></li>106</ul>107<ul>108<li><a href="$hsty_base/about/">About</a>109<ul>110<li><a href="$hsty_base/projects/newbies/">Introduction</a></li>111<li><a href="$hsty_base/features/">Features</a></li>112<li><a href="$hsty_base/advocacy/">Advocacy</a></li>113<li><a href="$hsty_base/marketing/">Marketing</a></li>114</ul>115</li>116</ul>117<ul>118<li><a href="$hsty_base/where/">Get FreeBSD</a>119<ul>120<li><a href="$hsty_base/releases/">Release Information</a></li>121<li><a href="$hsty_base/releng/">Release Engineering</a></li>122</ul>123</li>124</ul>125<ul>126<li><a href="$hsty_base/docs/">Documentation</a>127<ul>128<li><a href="https://docs.freebsd.org/en/books/faq/">FAQ</a></li>129<li><a href="https://docs.freebsd.org/en/books/handbook/">Handbook</a></li>130<li><a href="https://docs.freebsd.org/en/books/porters-handbook/">Porter's Handbook</a></li>131<li><a href="https://docs.freebsd.org/en//books/developers-handbook/">Developer's Handbook</a></li>132<li><a href="$hsty_base/cgi/man.cgi">Manual Pages</a></li>133<li><a href="https://docs.freebsd.org/en/books/fdp-primer/">Documentation Project Primer</a></li>134<li><a href="$hsty_base/docs/books/">All Books and Articles</a></li>135</ul>136</li>137</ul>138<ul>139<li><a href="$hsty_base/community.html">Community</a>140<ul>141<li><a href="$hsty_base/community/mailinglists.html">Mailing Lists</a></li>142<li><a href="https://forums.FreeBSD.org">Forums</a></li>143<li><a href="$hsty_base/usergroups.html">User Groups</a></li>144<li><a href="$hsty_base/events/events.html">Events</a></li>145</ul>146</li>147</ul>148<ul>149<li><a href="$hsty_base/projects/index.html">Developers</a>150<ul>151<li><a href="$hsty_base/projects/ideas/ideas.html">Project Ideas</a></li>152<li><a href="https://cgit.FreeBSD.org">GIT Repository</a></li>153</ul>154</li>155</ul>156<ul>157<li><a href="$hsty_base/support.html">Support</a>158<ul>159<li><a href="$hsty_base/commercial/commercial.html">Vendors</a></li>160<li><a href="https://security.FreeBSD.org/">Security Information</a></li>161<li><a href="https://bugs.freebsd.org/search/">Bug Reports</a></li>162<li><a href="$hsty_base/support.html">Submit Bug-report</a></li>163</ul>164</li>165</ul>166<ul>167<li><a href="https://www.freebsdfoundation.org/">Foundation</a>168<ul>169<li><a href="https://www.freebsdfoundation.org/donate/">Donate</a></li>170</ul>171</li>172</ul>173</div> <!-- MENU -->174</div>175176<div id="content">177`;178179#XXX does anyone use this? I don't know what it should be in the new style.180if (!defined($hsty_home)) {181$hsty_home = "<a href='$hsty_base/'><img src='$hsty_base/gifs/home.gif'182alt='FreeBSD Home Page' border='0' align='right'></a>";183}184185sub html_header {186local ($title, $xhtml) = @_;187188return short_html_header($title, $xhtml) . "<br/>\n<h1>$title</h1>\n";189}190191sub short_html_header {192local ($title, $xhtml) = @_;193194$xhtml = 1 unless defined($xhtml);195$doctype = $xhtml ? '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' : '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';196$html = $xhtml ? '<html xmlns="http://www.w3.org/1999/xhtml">' : '<html>';197$endslash = $xhtml ? '/' : '';198$csshack = (1 || $xhtml) ? '' : q`<style type="text/css">199tr, td {200margin: 0;201padding: 0;202font-family: verdana, sans-serif;203font-size: 69%;204color: #000;205}206</style>207`;208209return qq`Content-type: text/html210211$doctype212$html213214<head><title>$title</title>215<meta http-equiv='content-type' content='text/html; charset=$hsty_charset' $endslash>216<meta name='robots' content='nofollow' $endslash>217<link rel="stylesheet" media="screen"218href="$hsty_base/layout/css/fixed.css" type="text/css"219title="Normal Text" $endslash>220<link rel="alternate stylesheet" media="screen"221href="$hsty_base/layout/css/fixed_large.css" type="text/css"222title="Large Text" $endslash>223<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />224<link rel="apple-touch-icon" href="/favicon.ico" type="image/x-icon" />225$csshack226$t_style227</head>228<body>229$i_topbar230`;231}232233sub html_footer {234return qq`235</div>236<div id="footer">237<a href="$hsty_base/copyright/">Legal Notices</a> | © 1995-2026238The FreeBSD Project. All rights reserved.<br />239<address>$hsty_author<br />$hsty_date</address>240</div>241</div>242</div>243</body>244</html>245`;246247248}249250sub get_the_source {251return if $ENV{'PATH_INFO'} ne '/get_the_source';252253open(R, $0) || do {254print "Oops! open $0: $!\n"; # should not reached255exit;256};257258print "Content-type: text/plain\n\n";259while(<R>) { print }260close R;261exit;262}2632641;265266267