function Display()
 {
     freshports_ConditionalGet($this->getLastModified());
     # disable the HTML_Page2 headers.  we do our own.
     #
     $this->setCache(true);
     parent::Display();
 }
Пример #2
0
function freshports_CategoryByElementID($db, $element_id, $PageNo = 1, $PageSize = DEFAULT_PAGE_SIZE)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/categories.php';
    $category = new Category($db);
    $category->FetchByElementID($element_id);
    freshports_ConditionalGet($category->last_modified);
    freshports_CategoryDisplay($db, $category, $PageNo, $PageSize);
}
Пример #3
0
<?php

#
# $Id: faq.php,v 1.7 2012-07-21 23:23:57 dan Exp $
#
# Copyright (c) 1998-2006 DVL Software Limited
#
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/common.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/freshports.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/databaselogin.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/getvalues.php';
freshports_ConditionalGet(freshports_LastModified());
freshports_Start('FAQ', 'freshports - new ports, applications', 'FreeBSD, index, applications, ports');
$ServerName = str_replace('freshports', 'FreshPorts', $_SERVER['SERVER_NAME']);
global $FreshPortsName;
global $FreshPortsSlogan;
?>
	<?php 
echo freshports_MainTable();
?>

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

	<?php 
echo freshports_MainContentTable(NOBORDER);
?>


<tr>
	<?php 
echo freshports_PageBannerText("FAQ");
Пример #4
0
#
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/common.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/freshports.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/databaselogin.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/getvalues.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/ports.php';
require_once 'Pager/Pager.php';
$Debug = 0;
#	if ($Debug) phpinfo();
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
if ($https) {
    $protocol = "https";
} else {
    $protocol = "http";
}
freshports_ConditionalGet(freshports_LastModified_Dynamic());
define('ORDERBYPORT', 'port');
define('ORDERBYCATEGORY', 'category');
define('ORDERBYASCENDING', 'asc');
define('ORDERBYDESCENDING', 'desc');
define('INCLUDE_DELETED_PORTS', 'includedeleted');
define('INCLUDE_SRC_COMMITS', 'include_src_commits');
define('VEVENSHTEIN_MATCH', 3);
$PageNumber = 1;
$PageSize = 100;
if (isset($_REQUEST['page'])) {
    $PageNumber = intval($_REQUEST['page']);
    if ($PageNumber != $_REQUEST['page']) {
        $PageNumber = 1;
    }
}
Пример #5
0
function freshports_NonPortDescription($db, $element_record)
{
    global $TableWidth;
    global $FreshPortsTitle;
    $Debug = 1;
    freshports_ConditionalGet(freshports_LastModified());
    header("HTTP/1.1 200 OK");
    $Title = preg_replace('|^/?ports/|', '', $element_record->element_pathname);
    $FileName = preg_replace('|^/?ports/|', '', $element_record->element_pathname);
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/getvalues.php';
    freshports_Start($Title, "{$FreshPortsTitle} - new ports, applications", "FreeBSD, index, applications, ports");
    ?>

	<?php 
    echo freshports_MainTable();
    ?>

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

	<?php 
    echo freshports_MainContentTable();
    ?>
<TR>
<?php 
    echo freshports_PageBannerText('non port: ' . $Title);
    ?>
</TR>
<tr><td>
<a HREF="<?php 
    echo FRESHPORTS_FREEBSD_SVN_URL . $element_record->element_pathname;
    ?>
?view=log">SVNWeb</a>
</td></tr>

<?php 
    global $User;
    # these two options must be the last on the line.  And as such are mutually exclusive
    define('BYPASSCACHE', 'bypasscache=1');
    # do not read the cache for display
    define('REFRESHCACHE', 'refreshcache=1');
    # refresh the cache
    $BypassCache = substr($_SERVER["REQUEST_URI"], strlen($_SERVER["REQUEST_URI"]) - strlen(BYPASSCACHE)) == BYPASSCACHE;
    $RefreshCache = substr($_SERVER["REQUEST_URI"], strlen($_SERVER["REQUEST_URI"]) - strlen(REFRESHCACHE)) == REFRESHCACHE;
    $PageNumber = 1;
    if (isset($_SERVER['REDIRECT_QUERY_STRING'])) {
        parse_str($_SERVER['REDIRECT_QUERY_STRING'], $query_parts);
        if (isset($query_parts['page']) && Is_Numeric($query_parts['page'])) {
            $PageNumber = intval($query_parts['page']);
            if ($PageNumber != $query_parts['page'] || $PageNumber < 1) {
                $PageNumber = 1;
            }
        }
    }
    $NumCommitsPerPage = $User->page_size;
    $Cache = new CacheFile();
    $Cache->PageSize = $User->page_size;
    $result = $Cache->Retrieve($FileName, $PageNumber);
    if (!$result && !$BypassCache && !$RefreshCache) {
        if ($Debug) {
            echo "found something from the cache<br>\n";
        }
        $HTML = $Cache->CacheDataGet();
        #
        # we need to know the element_id of this port
        # and the whether or not it is on the person's watch list
        # let's create a special function for that!
        #
        $EndOfFirstLine = strpos($HTML, "\n");
        if ($EndOfFirstLine == false) {
            die('Internal error: I was expecting an ElementID and found nothing');
        }
        # extract the ElementID from the cache
        $ElementID = intval(substr($HTML, 0, $EndOfFirstLine));
        if ($ElementID == 0) {
            syslog(LOG_ERR, "Extract of ElementID from cache failed.  Is cache corrupt/deprecated? port was {$category}/{$port}");
            die('sorry, I encountered a problem with the cache.  Please send the URL and this message to the webmaster.');
        }
        if ($User->id) {
            $OnWatchList = freshports_OnWatchList($db, $User->id, $ElementID);
        } else {
            $OnWatchList = 0;
        }
        $HTML = substr($HTML, $EndOfFirstLine + 1);
    } else {
        if ($Debug) {
            echo "found NOTHING in cache<br>\n";
        }
        $HTML = '';
        $Commits = new CommitsByTreeLocation($db);
        $Commits->SetLimit($Cache->PageSize);
        $Commits->Debug = $Debug;
        $Commits->UserIDSet($User->id);
        $Commits->TreePathConditionSet("= '" . $element_record->element_pathname . "'");
        #
        # get the count without excuting the whole query
        # we don't want to pull back all the data.
        #
        $NumCommits = $Commits->GetCountCommits();
        $params = array('mode' => 'Sliding', 'perPage' => $NumCommitsPerPage, 'delta' => 5, 'totalItems' => $NumCommits, 'urlVar' => 'page', 'currentPage' => $PageNumber, 'spacesBeforeSeparator' => 1, 'spacesAfterSeparator' => 1, 'append' => false, 'path' => '/' . preg_replace('|^/?ports/|', '', $element_record->element_pathname), 'fileName' => '?page=%d', 'altFirst' => 'First Page', 'firstPageText' => 'First Page', 'altLast' => 'Last Page', 'lastPageText' => 'Last Page');
        $Pager =& Pager::factory($params);
        $links = $Pager->GetLinks();
        $NumCommitsHTML = '<tr><td><p align="left">Number of commits found: ' . $NumCommits;
        $Offset = 0;
        $PageLinks = $links['all'];
        $PageLinksHTML = str_replace('/?page=1"', '"', $PageLinks);
        $PageLinksHTML = str_replace('/?page=', '?page=', $PageLinksHTML);
        if ($PageLinksHTML != '') {
            $offset = $Pager->getOffsetByPageId();
            $NumOnThisPage = $offset[1] - $offset[0] + 1;
            $Offset = $offset[0] - 1;
            $NumCommitsHTML .= " (showing only {$NumOnThisPage} on this page)";
            unset($offset);
        }
        if ($PageNumber > 1) {
            $Commits->SetOffset($Offset);
        }
        $NumCommitsHTML .= '</p>';
        if ($PageLinksHTML != '') {
            $PageLinksHTML = '<p align="center">' . $PageLinksHTML . '</p>';
        }
        $NumCommitsHTML .= $PageLinksHTML . '</td></tr>';
        $HTML = $NumCommitsHTML;
        if ($Commits->Debug) {
            echo "PageNumber='{$PageNumber}'<br>Offset='{$Offset}'<br>";
        }
        $NumFetches = $Commits->Fetch();
        $DisplayCommit = new DisplayCommit($db, $Commits->LocalResult);
        $HTML .= $DisplayCommit->CreateHTML();
        $HTML .= $NumCommitsHTML;
        # If we are not reading
        if (!$BypassCache || $RefreshCache) {
            $Cache->CacheDataSet($element_record->{'id'} . "\n" . $HTML);
            $Cache->Add($FileName, $PageNumber);
        }
    }
    echo $HTML;
    echo "</table>\n";
    ?>

</TD>
  <TD VALIGN="top" WIDTH="*" ALIGN="center">
  <?php 
    echo freshports_SideBar();
    ?>
  </td>
</TR>

</TABLE>

<?php 
    echo freshports_ShowFooter();
    ?>

</body>
</html>

<?php 
}
Пример #6
0
if ($message_id != '') {
    require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/commit.php';
    $Commit = new Commit($db);
    $Commit->FetchByMessageId($message_id);
    freshports_ConditionalGet($Commit->last_modified);
} else {
    if ($revision != '') {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/commit.php';
        $Commit = new Commit($db);
        // Get the message IDs for this revision
        $message_id_array = $Commit->FetchByRevision($revision);
        if (count($message_id_array) == 1) {
            header('Location: /commit.php?message_id=' . $message_id_array[0]);
            exit;
        }
        freshports_ConditionalGet($Commit->last_modified);
        if ($Debug) {
            echo 'oh... got something back there: <pre>' . print_r($message_id_array, true) . '</pre>';
        }
    }
}
if (isset($_REQUEST['page'])) {
    $PageNo = $_REQUEST['page'];
}
if (isset($_REQUEST['page_size'])) {
    $PageSize = $_REQUEST['page_size'];
}
if ($Debug) {
    echo "\$page      = '{$page}'<br>\n";
    echo "\$page_size = '{$page_size}'<br>\n";
}
Пример #7
0
list($year, $month, $day) = explode('/', $Date);
if (!CheckDate($month, $day, $year)) {
    $DateMessage = 'date adjusted to something realistic';
    $Date = date('Y/m/d');
} else {
    $Date = date('Y/m/d', strtotime($Date));
}
if (isset($_REQUEST['branch'])) {
    $BranchName = htmlspecialchars($_REQUEST['branch']);
} else {
    $BranchName = BRANCH_HEAD;
}
$commits = new Commits($db, $BranchName);
$last_modified = $commits->LastModified($Date);
$NumCommits = $commits->Count($Date);
freshports_ConditionalGet($last_modified);
freshports_Start($FreshPortsSlogan, $FreshPortsName . ' - new ports, applications', 'FreeBSD, index, applications, ports');
$Debug = 0;
$ArchiveBaseDirectory = $_SERVER['DOCUMENT_ROOT'] . '/archives';
function ArchiveFileName($Date)
{
    $File = $ArchiveBaseDirectory . '/' . $Date . '.daily';
}
function ArchiveDirectoryCreate($Date)
{
    $SubDir = date('Y/m', strtotime($Date));
    $DirToCreate = $ArchiveBaseDirectory . '/' . $SubDir;
    system("mkdir -p {$DirToCreate}");
    return $DirToCreate;
}
function ArchiveExists($Date)