Пример #1
0
function freshports_ListOfPorts($result, $db, $ShowDateAdded, $ShowCategoryHeaders, $User, $PortCount = -1)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/ports.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/port-display.php';
    $port_display = new port_display($db, $User);
    $port_display->SetDetailsReports();
    $port = new Port($db);
    $port->LocalResult = $result;
    $LastCategory = '';
    $GlobalHideLastChange = 'N';
    $numrows = pg_numrows($result);
    if ($PortCount == -1) {
        $PortCount = $numrows;
    }
    $PortCountText = "<TR><TD>{$PortCount} ports found.";
    if ($numrows != $PortCount) {
        $PortCountText .= " (showing only {$numrows} ports on this page)";
    }
    $PortCountText .= "</TD></TR>\n";
    $HTML = $PortCountText;
    $HTML .= "<TR><TD>\n";
    $HTML .= "<br><center>\n" . Ad_728x90() . "\n</center>\n";
    if ($numrows > 0 && $ShowCategoryHeaders) {
        $HTML .= '<DL>';
    }
    for ($i = 0; $i < $numrows; $i++) {
        $port->FetchNth($i);
        if ($ShowCategoryHeaders) {
            $Category = $port->category;
            if ($LastCategory != $Category) {
                if ($i > 0) {
                    $HTML .= "\n</DD>\n";
                }
                $LastCategory = $Category;
                if ($ShowCategoryHeaders) {
                    $HTML .= '<DT>';
                }
                $HTML .= '<BIG><BIG><B><a href="/' . $Category . '/">' . $Category . '</a></B></BIG></BIG>';
                if ($ShowCategoryHeaders) {
                    $HTML .= "</DT>\n<DD>";
                }
            }
        }
        $port_display->port = $port;
        $Port_HTML = $port_display->Display();
        $HTML .= $port_display->ReplaceWatchListToken($port->{'onwatchlist'}, $Port_HTML, $port->{'element_id'});
        $HTML .= '<BR>';
    }
    if ($numrows && $ShowCategoryHeaders) {
        $HTML .= "\n</DD>\n</DL>\n";
    }
    $HTML .= "</TD></TR>\n";
    $HTML .= $PortCountText;
    return $HTML;
}
Пример #2
0
	<?php 
echo freshports_MainContentTable(NOBORDER);
?>


<tr>
	<?php 
echo freshports_PageBannerText("FAQ");
?>
</tr>
<TR><TD>

<CENTER>
<?php 
if ($ShowAds) {
    echo Ad_728x90();
}
?>
</CENTER>

<P>This page contains the FAQ for FreshPorts. Hopefully the questions
are arranged from general to specific.  The more you know, the further
down you must read to find something you didn't already know.</P>
</TD></TR>
<TR><TD>&nbsp;</TD></TR>

<TR>

<?php 
echo freshports_PageBannerText("What is this website about?");
?>
Пример #3
0
function freshports_ShowFooter($PhorumBottom = 0)
{
    global $TableWidth;
    global $Statistics;
    global $ShowPoweredBy;
    global $ShowAds;
    $HTML = '<table width="' . $TableWidth . '" border="0" align="center">
<tr><td>';
    if ($ShowAds) {
        $HTML .= "<div align=\"center\">\n";
        if ($PhorumBottom) {
            $HTML .= Ad_728x90PhorumBottom();
        } else {
            $HTML .= Ad_728x90();
        }
        $HTML .= "</div>\n";
    }
    $HTML .= '
<HR>
<table width="98%" border="0">
';
    if (isset($ShowPoweredBy)) {
        $HTML .= '
<tr>

<td align="center">

<a href="http://www.freebsd.org/"><img src="/images/pbfbsd2.gif"
alt="powered by FreeBSD" border="0" width="171" height="64"></a>

&nbsp;

<a href="http://www.php.net/"><img src="/images/php-med-trans-light.gif"
alt="powered by php" border="0" width="95" height="50"></a>
&nbsp;

<a href="http://www.postgresql.org/"><img src="/images/pg-power.jpg"
alt="powered by PostgreSQL" border="0" width="164" height="59"></a>


</td></tr>
<tr><td align="center">

<a href="http://www.phorum.org/"><img src="/phorum/images/phorum.gif"
alt="powered by phorum" border="0" width="200" height="50"></a>


&nbsp;&nbsp;&nbsp;

<a href="http://www.apache.org/"><img src="/images/apache_pb.gif" 
alt="powered by apache" border="0" width="259" height="32"></a>

<HR>

</tr>
';
    }
    $HTML .= '
<tr><td>
<table width="100%">
<tr>
<td align="left"  valign="top">
<small>' . SPONSORS . '</small>
</td>
<td align="right" valign="top">
<small>
Valid 
<a href="http://validator.w3.org/check/referer" title="We like to keep our HTML valid">HTML</a>, 
<a href="http://jigsaw.w3.org/css-validator/check/referer" title="We like to have valid CSS">CSS</a>, and
<a href="http://feedvalidator.org/check.cgi?url=http://' . $_SERVER['HTTP_HOST'] . '/backend/rss2.0.php" title="Valid RSS is good too">RSS</a>.
</small>
<br>' . freshports_copyright() . '
</td></tr>
</table>
</td></tr>
</table>';
    $HTML .= '
</td></tr>
</table>
';
    if ($ShowAds) {
        $HTML .= freshports_GoogleAnalytics();
    }
    $HTML .= '<script src="/javascript/freshports.js" type="text/javascript"></script>';
    $Statistics->Save();
    return $HTML;
}
Пример #4
0
function Ad_728x90PhorumTop()
{
    return Ad_728x90();
}
Пример #5
0
function freshports_CategoryDisplay($db, $category, $PageNo = 1, $PageSize = DEFAULT_PAGE_SIZE)
{
    global $TableWidth;
    global $User;
    header('HTTP/1.1 200 OK');
    $Debug = 0;
    if (isset($_SERVER['REDIRECT_QUERY_STRING'])) {
        if (isset($_SERVER["REDIRECT_QUERY_STRING"])) {
            parse_str($_SERVER['REDIRECT_QUERY_STRING'], $query_parts);
            if (isset($query_parts['page'])) {
                $PageNo = $query_parts['page'];
            }
            if (isset($query_parts['page_size'])) {
                $PageSize = $query_parts['page_size'];
            }
        }
    }
    if (!isset($page) || $page == '') {
        $page = 1;
    }
    if (!isset($page_size) || $page_size == '') {
        $page_size = $User->page_size;
    }
    if ($Debug) {
        echo "\$page      = '{$page}'<br>\n";
        echo "\$page_size = '{$page_size}'<br>\n";
    }
    SetType($PageNo, "integer");
    SetType($PageSize, "integer");
    if (!isset($PageNo) || !str_is_int("{$PageNo}") || $PageNo < 1) {
        $PageNo = 1;
    }
    if (!isset($PageSize) || !str_is_int("{$PageSize}") || $PageSize < 1 || $PageSize > MAX_PAGE_SIZE) {
        $PageSize = DEFAULT_PAGE_SIZE;
    }
    if ($Debug) {
        echo "\$PageNo   = '{$PageNo}'<br>\n";
        echo "\$PageSize = '{$PageSize}'<br>\n";
    }
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/categories.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/watch_lists.php';
    if ($category->IsPrimary()) {
        $WatchLists = new WatchLists($db);
        $WatchListCount = $WatchLists->IsOnWatchList($User->id, $category->element_id);
    }
    $title = $category->{'name'};
    # find out how many ports are in this category
    $PortCount = $category->PortCount($category->name);
    global $User;
    if ($Debug) {
        echo "\$User->id='{$User->id}'";
    }
    freshports_Start($title, 'freshports - new ports, applications', 'FreeBSD, index, applications, ports');
    $port = new Port($db);
    $numrows = $port->FetchByCategoryInitialise($category->name, $User->id, $PageSize, $PageNo);
    ?>

	<?php 
    echo freshports_MainTable();
    ?>

	<tr><td valign="top" width="100%">

	<?php 
    echo freshports_MainContentTable();
    ?>

		<tr>
		 <?php 
    echo freshports_PageBannerText('Category listing - ' . $category->{'name'});
    ?>
		</tr>

	<tr><td>
<?php 
    if ($category->IsPrimary()) {
        if ($WatchListCount) {
            echo freshports_Watch_Link_Remove('', 0, $category->{'element_id'});
        } else {
            echo freshports_Watch_Link_Add('', 0, $category->{'element_id'});
        }
    }
    ?>
	
<BIG><BIG><B><?php 
    echo $category->{'description'};
    ?>
</B></BIG></BIG>- Number of ports in this category: <?php 
    echo $PortCount;
    ?>
<p>
	Ports marked with a <sup>*</sup> actually reside within another category but
	have <b><?php 
    echo $category->{'name'};
    ?>
</b> listed as a secondary category.

<?php 
    global $ShowAds, $BannerAd;
    if ($ShowAds && $BannerAd) {
        echo "<br><center>\n" . Ad_728x90() . "\n</center>\n";
    }
    echo '<div align="center"><br>';
    freshports_CategoryNextPreviousPage($category->name, $PortCount, $PageNo, $PageSize);
    echo '</div>';
    ?>
	</td></tr>

<?php 
    if ($Debug) {
        echo "\$CategoryID = '{$CategoryID}'<BR>\n";
        echo "GlobalHideLastChange = {$GlobalHideLastChange}<BR>\n";
        echo "\$numrows = {$numrows}<BR>\n";
    }
    $ShowShortDescription = "Y";
    $HTML = freshports_echo_HTML("<TR>\n<TD>\n");
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/port-display.php';
    $port_display = new port_display($db, $User);
    $port_display->SetDetailsCategory();
    for ($i = 0; $i < $numrows; $i++) {
        $port->FetchNth($i);
        $port_display->port = $port;
        $Port_HTML = $port_display->Display();
        $HTML .= $port_display->ReplaceWatchListToken($port->{'onwatchlist'}, $Port_HTML, $port->{'element_id'});
    }
    // end for
    echo $HTML;
    ?>
</TD></TR>
<TR><TD>
<div align="center"><br>
<?php 
    freshports_CategoryNextPreviousPage($category->name, $PortCount, $PageNo, $PageSize);
    ?>
</div> 
</TD></TR>
</TABLE>
  <TD VALIGN="top" WIDTH="*" ALIGN="center">
  <?php 
    echo freshports_SideBar();
    ?>
  </td>
</TR>
</TABLE>

<?php 
    echo freshports_ShowFooter();
    ?>

	</body>
	</html>

	<?php 
}