diff --git a/website/content/en/cgi/cgi-style-responsive.pl b/website/content/en/cgi/cgi-style-responsive.pl new file mode 100644 index 0000000000..809ac9f876 --- /dev/null +++ b/website/content/en/cgi/cgi-style-responsive.pl @@ -0,0 +1,509 @@ +# +# Perl routines to encapsulate various elements of HTML page style. + +# For future reference, when is now? +( $se, $mn, $hr, $md, $mo, $yr, $wd, $yd, $dst ) = localtime(time); +$yr += 1900; +$mo += 1; +$timestamp = "$mo-$md-$yr"; + +if ( !defined($hsty_base) ) { + + # $hsty_base should be relative if possible, so that mirrors + # serve their local copy instead of going to the main site. + # However, if we aren't running as a cgi, or if we're + # running on one of the subdomains listed below, use the absolute home path. + if ( !defined( $ENV{'HTTP_HOST'} ) + || $ENV{'FREEBSD_WWW_PROD'} + || $ENV{'HTTP_HOST'} =~ +/(docs|docs-archive|mail-archive|man|man-dev|people|ports|ports-dev).freebsd.org/i + ) + { + $hsty_base = 'https://www.FreeBSD.org'; + } + else { + $hsty_base = '..'; + } +} + +if ( !defined($hsty_email) ) { + $hsty_email = 'Contact'; +} +if ( !defined($hsty_author) ) { + $hsty_author = "$hsty_email"; +} + +if ( !defined($hsty_date) ) { + $hsty_date = ''; +} + +if ( !defined($hsty_charset) ) { + $hsty_charset = 'iso-8859-1'; +} + +# This can be set to either a string containing an inline CSS stylesheet +# or to a element that references an external CSS stylesheet, to +# make local modifications to the style of a CGI script's output. +$t_style = ""; # Don't allow script to override completely, just + # let the script's setting cascade with the master. + +$i_topbar = qq` +
+
+
+ + +
+ + +
+ + +
+ + + + +
+ +
+
+
+ + +
+
+ + +
+ +`; + +sub html_header { + local ( $title, $xhtml ) = @_; + + return short_html_header( $title, $xhtml ) . "\n

$title

\n"; +} + +sub short_html_header { + local ( $title, $xhtml ) = @_; + + $xhtml = 1 unless defined($xhtml); + $doctype = + $xhtml + ? '' + : ''; + $html = $xhtml ? '' : ''; + $endslash = $xhtml ? '/' : ''; + + $csshack = ( 1 || $xhtml ) ? '' : q` +`; + + return qq`Content-type: text/html + + + + + + + + + + + + $title + + + + + + + + + + + + + + + + + + + + $csshack + $t_style + + + + +
+ +$i_topbar +`; +} + +sub html_footer { + return qq` +
+
+
+ + + + + + + +`; + +} + +sub get_the_source { + return if $ENV{'PATH_INFO'} ne '/get_the_source'; + + open( R, $0 ) || do { + print "Oops! open $0: $!\n"; # should not reached + exit; + }; + + print "Content-type: text/plain\n\n"; + while () { print } + close R; + exit; +} + +1;