mirror of
https://git.code.sf.net/p/quake/website
synced 2024-11-28 06:53:50 +00:00
157 lines
4.7 KiB
PHP
157 lines
4.7 KiB
PHP
<?php
|
|
/* Helpful constants */
|
|
$tableHeadColor = '#737b9c';
|
|
$menuHeadColor = '#737b9c';
|
|
$menuBgColor = '#4b4f66';
|
|
/* Array functions */
|
|
// Search array for data
|
|
function inArray( $needle, $haystack )
|
|
{
|
|
$found = false;
|
|
|
|
for ( $ptr = 0 ; $ptr < count ( $haystack ) ; $ptr++ ) {
|
|
if ( $haystack[$ptr] == $needle ) {
|
|
$found = true;
|
|
}
|
|
}
|
|
return $found;
|
|
}
|
|
|
|
/* Network functions */
|
|
// Finger user @ host (for .plan)
|
|
function finger( $user, $host )
|
|
{
|
|
$fp = fsockopen( $host, 79, &$errno, &$errstr ) or die( "$errno: $errstr" );
|
|
fputs($fp, "$user\n");
|
|
while ( !feof( $fp ) ) {
|
|
echo fgets($fp, 128);
|
|
}
|
|
fclose($fp);
|
|
}
|
|
|
|
function progressKey() // Display key for progress bar
|
|
{
|
|
echo '<TR><TD> </TD><TD> </TD><TD align="center">' .
|
|
'<IMG src="/img/graph/ProgressBar.desc.png" ALT="0-33% Hackers, 34-67% Developers, 68-100% Users">' .
|
|
'</TD><TD> </TD><TD align="left" ></TD></TR>';
|
|
}
|
|
|
|
function progressBar( $name, $pct, $comments ) // display a 0-100% progress meter
|
|
{
|
|
$newPct = $pct - ($pct % 2);
|
|
$i = $pct;
|
|
$j = 100 - $newPct;
|
|
$result = '';
|
|
$result .= '<TR><TD align="right">' . $name . '</TD><TD> </TD><TD align="center">';
|
|
$result .= '<IMG src="/img/blank.gif" height="1" width="1" alt="' . $pct . '% Complete">';
|
|
for ( ; $i >= 20 ; $i -= 20 ) {
|
|
$result .= '<IMG src="/img/graph/ProgressBar.20.white.gif" alt=" ">';
|
|
}
|
|
for ( ; $i >= 10 ; $i -= 10 ) {
|
|
$result .= '<IMG src="/img/graph/ProgressBar.10.white.gif" alt=" ">';
|
|
}
|
|
for ( ; $i >= 2 ; $i -= 2 ) {
|
|
$result .= '<IMG src="/img/graph/ProgressBar.2.white.gif" alt=" ">';
|
|
}
|
|
for ( ; $j >= 20 ; $j -= 20 ) {
|
|
$result .= '<IMG src="/img/graph/ProgressBar.20.gray.gif" alt=" ">';
|
|
}
|
|
for ( ; $j >= 10 ; $j -= 10 ) {
|
|
$result .= '<IMG src="/img/graph/ProgressBar.10.gray.gif" alt=" ">';
|
|
}
|
|
for ( ; $j >= 2 ; $j -= 2 ) {
|
|
$result .= '<IMG src="/img/graph/ProgressBar.2.gray.gif" alt=" ">';
|
|
}
|
|
$result .= '</TD><TD> </TD><TD align="left" >' . $comments . '</TD></TR>';
|
|
echo $result;
|
|
}
|
|
|
|
/* Sections */
|
|
function isFocused( $name, $newname )
|
|
{
|
|
return ( strToLower( $name ) == strToLower( $newname ) ) ? 1 : 0;
|
|
}
|
|
|
|
function iconLink ( $url, $img, $desc, $border )
|
|
{
|
|
echo '<A class="tabs" href="' . $url . '"><IMG src="' . $img . '" alt="' . $desc . '" border="' . $border . '" width="24" height="24"></A> ';
|
|
}
|
|
|
|
/* Menu functions */
|
|
// Create a Menu item
|
|
function menuItemLink( $url, $desc )
|
|
{
|
|
echo '<A CLASS="menus" HREF="' . $url . '">' . $desc . '</A><BR>';
|
|
}
|
|
// Create a Menu Section header
|
|
function menuSectionHeader( $name, $fgColor , $bgColor, $intBgColor )
|
|
{
|
|
echo "\n<!-- menuSectionHeader(" . $name . ') -->' .
|
|
'<TABLE cellSpacing="0" cellPadding="3" width="100%" border=0 bgColor="' . $bgColor . '">' .
|
|
' <TR bgColor="' . $bgColor . '">' .
|
|
' <TD align="center">' .
|
|
' <IMG src="/img/blank.gif" height="1" width="135" alt="" border="0"><BR>' .
|
|
' <SPAN class="titlebar">' . $name . '</SPAN>' .
|
|
' </TD>' .
|
|
' </TR>' .
|
|
' <TR align="right" bgColor="' . $intBgColor . '">' .
|
|
' <TD>';
|
|
}
|
|
// Create a Menu Section footer
|
|
function menuSectionFooter()
|
|
{
|
|
echo ' </TD>' .
|
|
' </TR>' .
|
|
'</TABLE>';
|
|
}
|
|
/* Table functions */
|
|
//
|
|
function tableBoxHeader( $bgColor, $intBgColor )
|
|
{
|
|
echo '<TABLE cellSpacing="0" cellPadding="1" width="100%" border="0" bgColor="' . $bgColor . '">' .
|
|
' <TR>' .
|
|
' <TD>' .
|
|
' <TABLE cellspacing="1" cellpadding="2" width="100%" border="0" bgcolor="' . $intBgColor . '">';
|
|
}
|
|
|
|
function tableBoxFooter()
|
|
{
|
|
echo ' </TABLE>' .
|
|
' </TD>' .
|
|
' </TR>' .
|
|
'</TABLE>';
|
|
}
|
|
|
|
function tableTitle($name, $cols, $bgColor)
|
|
{
|
|
echo ' <TR bgColor="' . $bgColor . '" align="center">' .
|
|
' <TD colspan="' . $cols . '">' .
|
|
' <SPAN class="titlebar">' . $name . '</SPAN>' .
|
|
' </TD>' .
|
|
' </TR>';
|
|
}
|
|
|
|
function tableHeader( $cols, $fgColor, $bgColor )
|
|
{
|
|
echo '<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0" bgColor="' . $bgColor . '">';
|
|
}
|
|
|
|
function tableFooter()
|
|
{
|
|
echo '</TABLE>';
|
|
}
|
|
|
|
function tableNewsItem( $date, $user, $text )
|
|
{
|
|
echo '<TR><TD><DL><DT>Posted on ' . $date . ' by ' . $user . '</DT>' .
|
|
' <DD>' . $text . '</DD>' .
|
|
'</DL></TD></TR>';
|
|
}
|
|
|
|
function tableSpacer( $height, $width, $cols, $bgColor )
|
|
{
|
|
echo '<TD colSpan="' . $cols . '" width="' . $width . '" bgColor="' . $bgColor . '">' .
|
|
' <IMG src="/img/misc/blank.gif" height="' . $height . '" width="' . $width . '" border="0" alt="">' .
|
|
'</TD>';
|
|
}
|
|
?>
|