Beispiel #1
0
function freshports_PortCommitPrint($commit, $category, $port, $VuXMLList)
{
    global $DateFormatDefault;
    global $TimeFormatDefault;
    global $freshports_CommitMsgMaxNumOfLinesToShow;
    global $User;
    $HTML = '';
    # print a single commit for a port
    $HTML .= "<tr><td valign='top' NOWRAP>";
    $HTML .= $commit->commit_date . '<br>';
    // indicate if this port needs refreshing from CVS
    if ($commit->{'needs_refresh'}) {
        $HTML .= " " . freshports_Refresh_Icon_Link() . "\n";
    }
    $HTML .= freshports_Email_Link($commit->message_id);
    #	$HTML .= '&nbsp;&nbsp;'. freshports_Commit_Link($commit->message_id);
    if ($commit->EncodingLosses()) {
        $HTML .= '&nbsp;' . freshports_Encoding_Errors_Link();
    }
    $HTML .= ' ';
    $HTML .= freshports_Commit_Link_Port($commit->message_id, $category, $port);
    # output the VERSION and REVISION
    $PackageVersion = freshports_PackageVersion($commit->{'port_version'}, $commit->{'port_revision'}, $commit->{'port_epoch'});
    if (strlen($PackageVersion) > 0) {
        $HTML .= '&nbsp;&nbsp;<big><b>' . $PackageVersion . '</b></big>';
    }
    $HTML .= '<br>';
    if (isset($commit->svn_revision)) {
        $HTML .= freshports_svnweb_ChangeSet_Link($commit->svn_revision, $commit->svn_hostname, $commit->path_to_repo);
    }
    if ($commit->stf_message != '') {
        $HTML .= '&nbsp; ' . freshports_SanityTestFailure_Link($commit->message_id);
    }
    if (isset($VuXMLList[$commit->id])) {
        $HTML .= '&nbsp;<a href="/vuxml.php?vid=' . $VuXMLList[$commit->id] . '">' . freshports_VuXML_Icon() . '</a>';
    }
    $HTML .= "</td>\n";
    $HTML .= '    <td valign="top">';
    $HTML .= freshports_CommitterEmailLink($commit->committer) . '&nbsp;' . freshports_Search_Committer($commit->committer);
    $HTML .= "</td>\n";
    $HTML .= '    <td valign="top" width="*">';
    $HTML .= freshports_CommitDescriptionPrint($commit->description, $commit->encoding_losses, $freshports_CommitMsgMaxNumOfLinesToShow, freshports_MoreCommitMsgToShow($commit->message_id, $freshports_CommitMsgMaxNumOfLinesToShow));
    $HTML .= "</td>\n";
    $HTML .= "</tr>\n";
    return $HTML;
}
Beispiel #2
0
	<P><a name="watchlistcount"><?php 
echo freshports_WatchListCount_Icon();
?>
</a> Watch List Count (WLC): This is the number of watch lists which are watching 
	this port.  This might give you an idea of the popularity of the port.
	</P>

	<P><?php 
echo freshports_CVS_Icon();
?>
 CVS Repository: This link will take you to the CVS Repository entry
	for this version of the file.
	</P>

	<P><?php 
echo freshports_VuXML_Icon();
?>
 <a href="http://www.vuxml.org/freebsd/">VuXML</a> vulnerability.  Click icon for details.
	</P>

	<P><?php 
echo freshports_VuXML_Icon_Faded();
?>
 A past <a href="http://www.vuxml.org/freebsd/">VuXML</a> vulnerability.  Click icon for details.
	</P>

	<P><a name="restricted"><?php 
echo freshports_Restricted_Icon();
?>
</a> This port has some restrictions on it.
	</P>
 function CreateHTML()
 {
     global $freshports_CommitMsgMaxNumOfLinesToShow;
     $Debug = 0;
     if (!$this->result) {
         syslog(LOG_ERR, __FILE__ . '::' . __LINE__ . ': no result set supplied');
         die("read from database failed");
         exit;
     }
     $NumRows = pg_numrows($this->result);
     if ($this->Debug) {
         echo __FILE__ . ':' . __LINE__ . " Number of rows = {$NumRows}<br>\n";
     }
     if (!$NumRows) {
         $this->HTML = "<TR><TD>\n<P>Sorry, nothing found in the database....</P>\n</td></tr>\n";
         return $this->HTML;
     }
     # if we have a UserID, but no flagged commits, grab them
     #
     if ($this->UserID && !isset($this->FlaggedCommits)) {
         require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/commit_flag.php';
         $FlaggedCommits = new CommitFlag($this->dbh);
         $NumFlaggedCommits = $FlaggedCommits->Fetch($this->UserID);
         for ($i = 0; $i < $NumFlaggedCommits; $i++) {
             $FlaggedCommits->FetchNth($i);
             $this->FlaggedCommits[$FlaggedCommits->commit_log_id] = $FlaggedCommits->commit_log_id;
             if ($this->Debug) {
                 echo "fetching record # {$i} -> {$FlaggedCommits->commit_log_id}<br>";
             }
         }
     }
     $GlobalHideLastChange = "N";
     $this->HTML = "";
     # leave it all empty as a comparison point
     $PreviousCommit = new CommitRecord();
     $NumberOfPortsInThisCommit = 0;
     $MaxNumberPortsToShow = 10;
     $TooManyPorts = false;
     # we might not show all of a commit, just for the really big ones.
     for ($i = 0; $i < $NumRows; $i++) {
         $myrow = pg_fetch_array($this->result, $i);
         if ($Debug) {
             echo 'processing row ' . $i . ' ' . $myrow['commit_log_id'] . ' ' . $myrow['message_id'] . "<br>\n";
         }
         unset($mycommit);
         $mycommit = new CommitRecord();
         $mycommit->PopulateValues($myrow);
         // OK, while we have the log change log, let's put the port details here.
         if ($mycommit->commit_log_id != $PreviousCommit->commit_log_id) {
             if ($NumberOfPortsInThisCommit > $MaxNumberPortsToShow && !$this->ShowAllPorts) {
                 $this->HTML .= '<BR>' . freshports_MorePortsToShow($PreviousCommit->message_id, $NumberOfPortsInThisCommit, $MaxNumberPortsToShow);
             }
             $TooManyPorts = false;
             if ($i > 0) {
                 $this->HTML .= "\n<BLOCKQUOTE>";
                 $this->HTML .= freshports_CommitDescriptionPrint($PreviousCommit->commit_description, $PreviousCommit->encoding_losses, $Lines, freshports_MoreCommitMsgToShow($PreviousCommit->message_id, $Lines));
                 # close off the previous commit first
                 $this->HTML .= "\n</BLOCKQUOTE>\n</TD></TR>\n\n\n";
             }
             # count the number of ports in this commit.
             # first time into the loop, this will be executed.
             $NumberOfPortsInThisCommit = 0;
             $MaxNumberPortsToShow = 10;
             if ($mycommit->commit_date != $PreviousCommit->commit_date) {
                 $this->HTML .= '<TR><TD COLSPAN="3" BGCOLOR="' . BACKGROUND_COLOUR . '" HEIGHT="0">' . "\n";
                 $this->HTML .= '   <FONT COLOR="#FFFFFF"><BIG>' . FormatTime($mycommit->commit_date, 0, "D, j M Y") . '</BIG></FONT>' . "\n";
                 $this->HTML .= '</TD></TR>' . "\n\n";
             }
             global $freshports_mail_archive;
             $this->HTML .= "<TR><TD>\n";
             $this->HTML .= '<SMALL>';
             $this->HTML .= '[ ' . $mycommit->commit_time . ' ' . freshports_CommitterEmailLink($mycommit->committer) . ' ]';
             $this->HTML .= '</SMALL>';
             $this->HTML .= '&nbsp;';
             $this->HTML .= freshports_Email_Link($mycommit->message_id);
             $this->HTML .= '&nbsp;';
             if ($this->UserID) {
                 if (isset($this->FlaggedCommits[$mycommit->commit_log_id])) {
                     $this->HTML .= freshports_Commit_Flagged_Link($mycommit->message_id);
                 } else {
                     $this->HTML .= freshports_Commit_Flagged_Not_Link($mycommit->message_id);
                 }
             }
             if ($mycommit->EncodingLosses()) {
                 $this->HTML .= '&nbsp;' . freshports_Encoding_Errors();
             }
             if ($mycommit->stf_message != '') {
                 $this->HTML .= '&nbsp; ' . freshports_SanityTestFailure_Link($mycommit->message_id);
             }
             #        			echo '<pre>' . print_r($mycommit, true) . '</pre>';
             if ($mycommit->svn_revision != '') {
                 $this->HTML .= '&nbsp; ' . freshports_svnweb_ChangeSet_Link($mycommit->svn_revision, $mycommit->svn_hostname, $mycommit->path_to_repo);
             }
             $this->HTML .= "<br>\n";
         }
         $NumberOfPortsInThisCommit++;
         if ($NumberOfPortsInThisCommit > $MaxNumberPortsToShow && !$this->ShowAllPorts) {
             $TooManyPorts = true;
         }
         if (!$TooManyPorts) {
             if (isset($mycommit->category) && $mycommit->category != '') {
                 if ($this->UserID) {
                     if ($mycommit->watch) {
                         $this->HTML .= ' ' . freshports_Watch_Link_Remove($this->WatchListAsk, $mycommit->watch, $mycommit->element_id) . ' ';
                     } else {
                         $this->HTML .= ' ' . freshports_Watch_Link_Add($this->WatchListAsk, $mycommit->watch, $mycommit->element_id) . ' ';
                     }
                 }
                 $this->HTML .= '<BIG><B>';
                 $this->HTML .= '<A HREF="/' . $mycommit->category . '/' . $mycommit->port . '/">';
                 $this->HTML .= $mycommit->port;
                 $this->HTML .= '</A>';
                 $PackageVersion = freshports_PackageVersion($mycommit->version, $mycommit->revision, $mycommit->epoch);
                 if (strlen($PackageVersion) > 0) {
                     $this->HTML .= ' ' . $PackageVersion;
                 }
                 $this->HTML .= "</B></BIG>\n";
                 $this->HTML .= '<A HREF="/' . $mycommit->category . '/">';
                 $this->HTML .= $mycommit->category . "</A>";
                 $this->HTML .= '&nbsp;';
                 // indicate if this port has been removed from cvs
                 if ($mycommit->status == "D") {
                     $this->HTML .= " " . freshports_Deleted_Icon_Link() . "\n";
                 }
                 // indicate if this port needs refreshing from CVS
                 if ($mycommit->needs_refresh) {
                     $this->HTML .= " " . freshports_Refresh_Icon_Link() . "\n";
                 }
                 if ($mycommit->date_added > Time() - 3600 * 24 * $this->DaysMarkedAsNew) {
                     $MarkedAsNew = "Y";
                     $this->HTML .= freshports_New_Icon() . "\n";
                 }
                 if ($mycommit->forbidden) {
                     $this->HTML .= ' ' . freshports_Forbidden_Icon_Link() . "\n";
                 }
                 if ($mycommit->broken) {
                     $this->HTML .= ' ' . freshports_Broken_Icon_Link() . "\n";
                 }
                 if ($mycommit->deprecated) {
                     $this->HTML .= ' ' . freshports_Deprecated_Icon_Link() . "\n";
                 }
                 if ($mycommit->expiration_date) {
                     if (date('Y-m-d') >= $mycommit->expiration_date) {
                         $this->HTML .= freshports_Expired_Icon_Link($mycommit->expiration_date) . "\n";
                     } else {
                         $this->HTML .= freshports_Expiration_Icon_Link($mycommit->expiration_date) . "\n";
                     }
                 }
                 if ($mycommit->ignore) {
                     $this->HTML .= ' ' . freshports_Ignore_Icon_Link() . "\n";
                 }
                 $this->HTML .= freshports_Commit_Link_Port($mycommit->message_id, $mycommit->category, $mycommit->port);
                 $this->HTML .= "&nbsp;";
                 if ($mycommit->vulnerable_current) {
                     $this->HTML .= '&nbsp;' . freshports_VuXML_Icon() . '&nbsp;';
                 } else {
                     if ($mycommit->vulnerable_past) {
                         $this->HTML .= '&nbsp;' . freshports_VuXML_Icon_Faded() . '&nbsp;';
                     }
                 }
                 if ($mycommit->restricted) {
                     $this->HTML .= freshports_Restricted_Icon_Link($mycommit->restricted) . '&nbsp;';
                 }
                 if ($mycommit->no_cdrom) {
                     $this->HTML .= freshports_No_CDROM_Icon_Link($mycommit->no_cdrom) . '&nbsp;';
                 }
                 if ($mycommit->is_interactive) {
                     $this->HTML .= freshports_Is_Interactive_Icon_Link($mycommit->is_interactive) . '&nbsp;';
                 }
             } else {
                 # This is a non-port element...
                 $this->HTML .= $mycommit->revision . ' ';
                 $this->HTML .= '<big><B>';
                 $PathName = preg_replace('|^/?ports/|', '', $mycommit->element_pathname);
                 #				echo "'$PathName' " . "'" . $mycommit->repo_name . "'";
                 switch ($mycommit->repo_name) {
                     case 'ports':
                         $PathName = preg_replace('|^head/|', '', $PathName);
                         break;
                 }
                 if ($PathName != $mycommit->element_pathname) {
                     $this->HTML .= '<a href="/' . str_replace('%2F', '/', urlencode($PathName)) . '">' . $PathName . '</a>';
                     $this->HTML .= "</B></BIG>\n";
                 } else {
                     $this->HTML .= '<a href="' . FRESHPORTS_FREEBSD_CVS_URL . $PathName . '#rev' . $mycommit->revision . '">' . $PathName . '</a>';
                     $this->HTML .= "</B></BIG>\n";
                 }
             }
             $this->HTML .= htmlify(_forDisplay($mycommit->short_description)) . "\n";
             $this->HTML .= "<BR>\n";
             global $freshports_CommitMsgMaxNumOfLinesToShow;
             if ($this->ShowEntireCommit) {
                 $Lines = 0;
             } else {
                 $Lines = $freshports_CommitMsgMaxNumOfLinesToShow;
             }
         }
         # !$TooManyPorts
         $PreviousCommit = $mycommit;
     }
     if ($NumberOfPortsInThisCommit > $MaxNumberPortsToShow && !$this->ShowAllPorts) {
         $this->HTML .= '<BR>' . freshports_MorePortsToShow($PreviousCommit->message_id, $NumberOfPortsInThisCommit, $MaxNumberPortsToShow);
     }
     $this->HTML .= "\n<BLOCKQUOTE>";
     $this->HTML .= freshports_CommitDescriptionPrint($PreviousCommit->commit_description, $PreviousCommit->encoding_losses, $Lines, freshports_MoreCommitMsgToShow($PreviousCommit->message_id, $Lines));
     # close off the last commit
     $this->HTML .= "\n</BLOCKQUOTE>\n</TD></TR>\n\n\n";
     unset($mycommit);
     return $this->HTML;
 }