Exemplo n.º 1
0
function freshports_SideBar()
{
    global $User;
    $ColumnWidth = 160;
    $OriginLocal = rawurlencode($_SERVER["REQUEST_URI"]);
    $HTML = '
  <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5">
        <tr>
         <td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Login</b></big></FONT></td>
        </tr>
        <tr>

         <td NOWRAP>';
    if (isset($_COOKIE["visitor"])) {
        $visitor = $_COOKIE["visitor"];
    }
    if (isset($visitor)) {
        global $User;
        $HTML .= '<FONT SIZE="-1">Logged in as ' . $User->name . "</FONT><br>";
        if ($User->emailbouncecount > 0) {
            $HTML .= '<img src="/images/warning.gif" border="0" height="32" width="32"><img src="/images/warning.gif"  border="0" height="32" width="32"><img src="/images/warning.gif" border="0"height="32" width="32"><br>';
            $HTML .= '<FONT SIZE="-1">your email is <a href="/bouncing.php?origin=' . $OriginLocal . '">bouncing</a></FONT><br>';
            $HTML .= '<img src="/images/warning.gif" border="0" height="32" width="32"><img src="/images/warning.gif" border="0" height="32" width="32"><img src="/images/warning.gif" border="0" height="32" width="32"><br>';
        }
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/customize.php', "?origin={$OriginLocal}", "Customize", "Customize your settings") . '</FONT><br>';
        if (preg_match("/.*@FreeBSD.org/i", $User->email)) {
            $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/committer-opt-in.php', '', "Committer Opt-in", "Committers can receive reports of Sanity Test Failures") . '</FONT><br>';
        }
        # for a logout, where we go depends on where we are now
        #
        switch ($_SERVER["PHP_SELF"]) {
            case "customize.php":
            case "watch-categories.php":
            case "watch.php":
                $args = "?origin={$OriginLocal}";
                break;
            default:
                $args = '';
        }
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/logout.php', $args, "Logout", "Logout of the website") . '</FONT><br>';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/my-flagged-commits.php', $args, "My Flagged Commits", "List of commits you have flagged") . '</FONT><br>';
    } else {
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/login.php', "?origin={$OriginLocal}", "User Login", "Login to the website") . '</FONT><br>';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/new-user.php', "?origin={$OriginLocal}", "Create account", "Create an account") . '</FONT><br>';
    }
    $HTML .= '
   </td>
   </tr>
   </table>

' . '<div align="center">';
    $HTML .= '

<p><small>' . SPONSORS . '</small></p>
</div>';
    $HTML .= '	
<table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5">
	<tr>
		<td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>This site</b></big></FONT></td>
	</tr>
	<tr>
	<td valign="top">
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/about.php", "What is FreshPorts?", "A bit of background on FreshPorts") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/authors.php", "About the authors", "Who wrote this stuff?") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/faq.php", "FAQ", "Frequently Asked Questions") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/how-big-is-it.php", "How big is it?", "How many pages are in this website?") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/release-2004-10.php", "The latest upgrade!", "Details on the latest website upgrade") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/privacy.php", "Privacy", "Our privacy statement") . '</FONT><br>
	<FONT SIZE="-1"><a href="/phorum/" title="Discussion Forums">Forums</a></FONT><br>
	<FONT SIZE="-1"><a href="http://news.freshports.org/" title="All the latest FresHPorts news">Blog</a></FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/contact.php", "Contact", "Contact details") . '</FONT><br>
	</td>
	</tr>
</table>
<br>
<table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5">
	<tr>
		<td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Search</b></big></FONT></td>
	</tr>
	<tr>

	<td>';
    global $dbh;
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/searches.php';
    $Searches = new Searches($dbh);
    $HTML .= $Searches->GetFormSimple('&nbsp;');
    $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/search.php', '', "more...", "Advanced Searching options") . '</FONT><br>
	</td>
</tr>
</table>

';
    if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/vuln-latest.html")) {
        $HTML .= '<br>
<table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5">
	<tr>
		<td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Latest Vulnerabilities</b></big></FONT></td>
	</tr>
	<tr><td>
	' . file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/vuln-latest.html") . "\n" . '
	</td></tr>
	<tr><td align="center"><p><sup>*</sup> - modified, not new</p><p><a href="/vuxml.php?all">All vulnerabilities</a></p>
</table>
<br>';
    } else {
        $HTML .= "<br>\n";
    }
    $HTML .= '

<table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5">
	<tr>
		<td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Ports</b></big></FONT></td>
	</tr>
	<tr>
	<td valign="top">

	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/", "Home", "FreshPorts Home page") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/categories.php", "Categories", "List of all Port categories") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/ports-deleted.php", "Deleted ports", "All deleted ports") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/sanity_test_failures.php", "Sanity Test Failures", "Things that didn't go quite right...") . '</FONT><br>
	<FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/backend/newsfeeds.php", "Newsfeeds", "Newsfeeds for just about everything") . '</FONT><br>
	
	</td>
	</tr>
</table>';
    if (isset($visitor)) {
        $HTML .= '<br>
<table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5">
	<tr>
		<td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Watch Lists</b></big></FONT></td>
	</tr>
	<tr>
	<td valign="top">';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/pkg_upload.php', '', "Upload", "Upoad a file containing a list of ports you want to add to your watch list") . '</FONT><br>';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/watch-categories.php', '', "Categories", "Search through categories for ports to add to your watch list") . '</FONT><br>';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/watch-list-maintenance.php', '', "Maintain", "Maintain your watch list[s]") . '</FONT><br>';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/watch.php', '', "Ports", "Your list of watched ports") . '</FONT><br>';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/backend/watch-list.php', '', "Personal Newsfeeds", "A list of news feeds for your watched lists") . '</FONT><br>';
        $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/report-subscriptions.php', '', "Report Subscriptions", "Maintain your list of subscriptions") . '</FONT><br>';
        $HTML .= '		
	</td>
	</tr>
</table>';
    }
    global $ShowAds;
    if ($ShowAds) {
        $HTML .= '<br><table border="0" cellpadding="5">
		  <tr><td align="center">
		';
        $HTML .= Ad_160x600();
        $HTML .= '</td></tr>
		  </table>
		 ';
    }
    $HTML .= '<br>

<table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5">
	<tr>
		<td COLSPAN="2" bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Statistics</b></big></FONT></td>
	</tr>
	<tr>
	<td valign="top">

' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/graphs.php", "Graphs", "Everyone loves statistics!") . '<br>
' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/graphs2.php", "NEW Graphs (Javascript)", "Everyone loves statistics!") . '<br>
' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/stats/", "Traffic", "Traffic to this website");
    if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/stats.html")) {
        $HTML .= '<br>
' . file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/stats.html") . "\n";
    }
    $HTML .= '
	</td>
	</tr>
</table>


';
    return $HTML;
}