예제 #1
0
 function Display()
 {
     $port = $this->port;
     $HTML = '';
     #		$HTML = $this->JavascriptInclude();
     $MarkedAsNew = "N";
     $HTML .= "<DL>\n";
     $HTML .= "<DT>";
     $HTML .= port_display_WATCH_LIST_ADD_REMOVE;
     $HTML .= '<BIG><B>';
     if ($this->LinkToPort) {
         $HTML .= $this->LinkToPort();
     } else {
         $HTML .= $port->port;
     }
     $HTML .= "</B></BIG>";
     // description
     if ($port->short_description && ($this->ShowShortDescription || $this->ShowEverything)) {
         $HTML .= ' <span class="fp_description_short">' . htmlify(_forDisplay($port->short_description)) . '</span>';
         $HTML .= "<br>\n";
     }
     $HTML .= "<b>";
     $PackageVersion = freshports_PackageVersion($port->{'version'}, $port->{'revision'}, $port->{'epoch'});
     if (strlen($PackageVersion) > 0) {
         $HTML .= ' ' . $PackageVersion;
     }
     if (isset($port->category_looking_at)) {
         if ($port->category_looking_at != $port->category) {
             $HTML .= '<sup>*</sup>';
         }
     }
     $HTML .= "</b>";
     if ($this->ShowEverything || $this->ShowCategory) {
         $HTML .= ' <A HREF="/' . $port->category . '/" TITLE="The category for this port">' . $port->category . '</A>';
     }
     // indicate if this port has been removed from cvs
     if ($port->IsDeleted()) {
         $HTML .= " " . freshports_Deleted_Icon_Link() . "\n";
     }
     // indicate if this port needs refreshing from CVS
     if ($port->{'needs_refresh'}) {
         $HTML .= " " . freshports_Refresh_Icon_Link() . "\n";
     }
     if ($port->{'date_added'} > Time() - 3600 * 24 * $this->DaysMarkedAsNew) {
         $MarkedAsNew = "Y";
         $HTML .= freshports_New_Icon() . "\n";
     }
     if ($this->ShowEverything || $this->ShowWatchListCount) {
         $HTML .= ' ' . freshPorts_WatchListCount_Icon_Link() . '=' . $port->WatchListCount();
     }
     $HTML .= ' ' . freshports_Search_Depends_All($port->category . '/' . $port->port);
     # if this port is, or every has been, vulnerable, display the right skull
     # and a link to the list of all such vulnerabilities
     if ($port->IsVulnerable() || $port->WasVulnerable()) {
         $HTML .= ' ' . freshports_VuXML_Link($port->package_name, $port->IsVulnerable());
     }
     # search for bugs related to this port
     $HTML .= ' ' . freshports_Search_For_Bugs($port->category . '/' . $port->port);
     # report a bug related to this port
     $HTML .= ' ' . freshports_Report_A_Bug($port->category . '/' . $port->port);
     $HTML .= "</DT>\n<DD>";
     # show forbidden and broken
     if ($port->forbidden) {
         $HTML .= freshports_Forbidden_Icon_Link($port->forbidden) . ' FORBIDDEN: ' . htmlify(_forDisplay($port->forbidden)) . "<br>";
     }
     if ($port->broken) {
         $HTML .= freshports_Broken_Icon_Link($port->broken) . ' BROKEN: ' . htmlify(_forDisplay($port->broken)) . "<br>";
     }
     if ($port->deprecated) {
         $HTML .= freshports_Deprecated_Icon_Link($port->deprecated) . ' DEPRECATED: ' . htmlify(_forDisplay($port->deprecated)) . "<br>";
     }
     if ($port->expiration_date) {
         if (date('Y-m-d') >= $port->expiration_date) {
             $HTML .= freshports_Expired_Icon_Link($port->expiration_date) . ' This port expired on: ' . $port->expiration_date . '<br>';
         } else {
             $HTML .= freshports_Expiration_Icon_Link($port->expiration_date) . ' EXPIRATION DATE: ' . $port->expiration_date . '<br>';
         }
     }
     if ($port->ignore) {
         $HTML .= freshports_Ignore_Icon_Link($port->ignore) . ' IGNORE: ' . htmlify(_forDisplay($port->ignore)) . "<br>";
     }
     if ($port->restricted) {
         $HTML .= freshports_Restricted_Icon_Link($port->restricted) . ' RESTRICTED: ' . htmlify(_forDisplay($port->restricted)) . '<br>';
     }
     if ($port->no_cdrom) {
         $HTML .= freshports_No_CDROM_Icon_Link($port->no_cdrom) . ' NO CDROM: ' . htmlify(_forDisplay($port->no_cdrom)) . '<br>';
     }
     if ($port->is_interactive) {
         $HTML .= freshports_Is_Interactive_Icon_Link($port->is_interactive) . ' IS INTERACTIVE: ' . htmlify(_forDisplay($port->is_interactive)) . '<br>';
     }
     // maintainer
     if ($port->maintainer && ($this->ShowMaintainedBy || $this->ShowEverything)) {
         if (strtolower($port->maintainer) == UNMAINTAINTED_ADDRESS) {
             $HTML .= '<br>There is no maintainer for this port.<br>';
             $HTML .= 'Any concerns regarding this port should be directed to the FreeBSD ' . 'Ports mailing list via ';
             $HTML .= '<A HREF="' . MAILTO . ':' . freshportsObscureHTML($port->maintainer);
             $HTML .= '?subject=FreeBSD%20Port:%20' . $port->category . '/' . $port->port . '" TITLE="email the FreeBSD Ports mailing list">';
             $HTML .= freshportsObscureHTML($port->maintainer) . '</A>';
         } else {
             $HTML .= '<b>';
             $HTML .= 'Maintainer:</b> <A HREF="' . MAILTO . ':' . freshportsObscureHTML($port->maintainer);
             $HTML .= '?subject=FreeBSD%20Port:%20' . $port->category . '/' . $port->port . '" TITLE="email the maintainer">';
             $HTML .= freshportsObscureHTML($port->maintainer) . '</A>';
         }
         $HTML .= ' ' . freshports_Search_Maintainer($port->maintainer) . '<br>';
     }
     // last commit date
     if (($this->ShowLastCommitDate || $this->ShowEverything) && $port->last_commit_date) {
         $HTML .= '<b>Last commit date:</b> ' . FormatTime($port->last_commit_date, 0, "Y-m-d H:i:s") . '<br>';
     }
     // there are only a few places we want to show the last change.
     // therefore, we do not check ShowEverything here
     if ($this->ShowLastChange) {
         if ($port->updated != 0) {
             $HTML .= 'last change committed by ' . freshports_CommitterEmailLink($port->committer);
             // separate lines in case committer is null
             $HTML .= ' ' . freshports_Search_Committer($port->committer);
             $HTML .= ' on <font size="-1">' . $port->updated . '</font>' . "\n";
             $HTML .= freshports_Email_Link($port->message_id);
             if ($port->EncodingLosses()) {
                 $HTML .= ' ' . freshports_Encoding_Errors_Link();
             }
             $HTML .= ' ' . freshports_Commit_Link($port->message_id);
             $HTML .= ' ' . freshports_Commit_Link_Port($port->message_id, $port->category, $port->port);
             global $freshports_CommitMsgMaxNumOfLinesToShow;
             $HTML .= freshports_PortDescriptionPrint($port->update_description, $port->encoding_losses, $freshports_CommitMsgMaxNumOfLinesToShow, freshports_MoreCommitMsgToShow($port->message_id, $freshports_CommitMsgMaxNumOfLinesToShow));
         } else {
             $HTML .= "no changes recorded in FreshPorts<br>\n";
         }
     }
     # show the date added, if asked
     if ($this->ShowDateAdded || $this->ShowEverything) {
         $HTML .= '<b>Port Added:</b> <font size="-1">';
         if ($port->date_added) {
             $HTML .= $port->date_added;
         } else {
             $HTML .= "unknown";
         }
         $HTML .= '</font><BR>' . "\n";
     }
     $HTML .= PeopleWatchingThisPortAlsoWatch($this->db, $port->element_id);
     if ($port->categories) {
         // remove the primary category and remove any double spaces or trailing/leading spaces
         // this ensures that explode gives us the right stuff
         if (isset($port->category_looking_at)) {
             $CategoryToRemove = $port->category_looking_at;
         } else {
             $CategoryToRemove = $port->category;
         }
         $Categories = str_replace($CategoryToRemove, '', $port->categories);
         $Categories = str_replace('  ', ' ', $Categories);
         $Categories = trim($Categories);
         if ($Categories) {
             $HTML .= "<b>Also Listed In:</b> ";
             $CategoriesArray = explode(" ", $Categories);
             $Count = count($CategoriesArray);
             for ($i = 0; $i < $Count; $i++) {
                 $Category = $CategoriesArray[$i];
                 #					$CategoryID = freshports_CategoryIDFromCategory($Category, $this->db);
                 #					if ($CategoryID) {
                 #						// this is a real category
                 $HTML .= '<a href="/' . $Category . '/">' . $Category . '</a>';
                 #					} else {
                 #						$HTML .= $Category;
                 #					}
                 if ($i < $Count - 1) {
                     $HTML .= " ";
                 }
             }
             $HTML .= "<br>\n";
         }
     }
     $HTML .= '<b>License:</b> ';
     if ($port->license) {
         $HTML .= htmlentities($port->license);
     } else {
         $HTML .= 'not specified in port';
     }
     $HTML .= "<br>\n";
     # The ad goes here
     if ($this->ShowAd || $this->ShowEverything) {
         $HTML .= port_display_AD;
     }
     if ($this->ShowDescriptionLong || $this->ShowEverything) {
         $HTML .= '<PRE CLASS="code">' . htmlify(_forDisplay($port->long_description)) . '</PRE>';
     }
     if ($this->ShowChangesLink || $this->ShowEverything) {
         # we want something like
         # http://svn.freebsd.org/ports/head/x11-wm/awesome/
         $HTML .= '<a href="http://' . $port->svn_hostname . $port->element_pathname . '/">SVNWeb</a>';
     }
     if ($port->PackageExists() && ($this->ShowPackageLink || $this->ShowEverything)) {
         // package
         $HTML .= ' <b>:</b> ';
         $HTML .= '<A HREF="' . FRESHPORTS_FREEBSD_FTP_URL . '/' . freshports_PackageVersion($port->version, $port->revision, $port->epoch);
         $HTML .= '.tgz">Package</A>';
     }
     if ($port->homepage && ($this->ShowHomepageLink || $this->ShowEverything)) {
         $HTML .= ' <b>:</b> ';
         $HTML .= '<a HREF="' . _forDisplay($port->homepage) . '" TITLE="Homepage for this port">Homepage</a>';
     }
     if (defined('DISTFILESSURVEYSHOW') && ($this->ShowDistfilesSurveyLink || $this->ShowEverything)) {
         $HTML .= ' <b>:</b> ' . freshports_DistFilesSurveyURL($port->category, $port->port);
     }
     if (defined('PORTSMONSHOW') && ($this->ShowPortsMonLink || $this->ShowEverything)) {
         $HTML .= ' <b>:</b> ' . freshports_PortsMonitorURL($port->category, $port->port);
     }
     if ($this->ShowEverything || $this->ShowMasterSlave) {
         #
         # Display our master port
         #
         $MasterSlave = new MasterSlave($port->dbh);
         $NumRows = $MasterSlave->FetchByMaster($port->category . '/' . $port->port);
         if ($port->IsSlavePort() || $NumRows > 0) {
             $HTML .= "\n<hr>\n";
         }
         if ($port->IsSlavePort()) {
             $HTML .= '<dl><dt><b>Master port:</b> ';
             list($MyCategory, $MyPort) = explode('/', $port->master_port);
             $HTML .= freshports_link_to_port($MyCategory, $MyPort);
             $HTML .= "</dt>\n";
             $HTML .= "</dl>\n";
         }
         #
         # Display our slave ports
         #
         if ($NumRows > 0) {
             $HTML .= '<span class="slaveports">Slave ports</span>' . "\n" . '<ol class="slaveports" id="slaveports">';
             for ($i = 0; $i < $NumRows; $i++) {
                 $MasterSlave->FetchNth($i);
                 $HTML .= '<li>' . freshports_link_to_port($MasterSlave->slave_category_name, $MasterSlave->slave_port_name) . '</li>';
             }
             $HTML .= "</ol>\n";
         }
     }
     if ($this->ShowDepends || $this->ShowEverything) {
         if ($port->depends_build || $port->depends_run || $port->depends_lib) {
             $HTML .= '<hr><p><big>NOTE: FreshPorts displays only information on required and default dependencies.  Optional dependencies are not covered.</big></p>';
         }
         if ($port->depends_build) {
             $HTML .= '<span class="required">Build dependencies:</span>' . "\n" . '<ol class="required" id="requiredtobuild">';
             $HTML .= freshports_depends_links($this->db, $port->depends_build);
             $HTML .= "\n</ol>\n";
         }
         if ($port->depends_run) {
             $HTML .= '<span class="required">Runtime dependencies:</span>' . "\n" . '<ol class="required" id="requiredtorun">';
             $HTML .= freshports_depends_links($this->db, $port->depends_run);
             $HTML .= "\n</ol>\n";
         }
         if ($port->depends_lib) {
             $HTML .= '<span class="required">Library dependencies:</span>' . "\n" . '<ol class="required" id="requiredlibraries">';
             $HTML .= freshports_depends_links($this->db, $port->depends_lib);
             $HTML .= "\n</ol>\n";
         }
         if ($port->fetch_depends) {
             $HTML .= '<span class="required">Fetch dependencies:</span>' . "\n" . '<ol class="required" id="requiredfetches">';
             $HTML .= freshports_depends_links($this->db, $port->fetch_depends);
             $HTML .= "\n</ol>\n";
         }
         if ($port->patch_depends) {
             $HTML .= '<span class="required">Patch dependencies:</span>' . "\n" . '<ol class="required" id="requiredpatches">';
             $HTML .= freshports_depends_links($this->db, $port->patch_depends);
             $HTML .= "\n</ol>\n";
         }
         if ($port->extract_depends) {
             $HTML .= '<span class="required">Extract dependencies:</span>' . "\n" . '<ol class="required" id="requiredextracts">';
             $HTML .= freshports_depends_links($this->db, $port->extract_depends);
             $HTML .= "\n</ol>\n";
         }
         # XXX when adding new depends above, be sure to update the array in ShowDependencies()
         $HTML .= $this->ShowDependencies($port);
     }
     # only show if we're meant to show, and if the port has not been deleted.
     if ($this->ShowPackageLink || $this->ShowEverything) {
         $HTML .= "\n<hr>\n";
         if ($port->IsDeleted()) {
             $HTML .= '<p>No installation instructions: this port has been deleted.</p>';
             $HTML .= '<p>The package name of this deleted port was: <code class="code">' . $port->latest_link . '</code></p>';
         } else {
             $HTML .= '<p><b>To install <a href="/faq.php#port" TITLE="what is a port?">the port</a>:</b> <code class="code">cd /usr/ports/' . $port->category . '/' . $port->port . '/ && make install clean</code><br>';
             if (isset($port->no_package) && $port->no_package != '') {
                 $HTML .= '<p><b>No <a href="/faq.php#package" TITLE="what is a package?">package</a> is available:</b> ' . $port->no_package . '</p>';
             } else {
                 if ($port->forbidden || $port->broken || $port->ignore || $port->restricted) {
                     $HTML .= '<p><b>A <a href="/faq.php#package" TITLE="what is a package?">package</a> is not available for ports marked as: Forbidden / Broken / Ignore / Restricted</b></p>';
                 } else {
                     $HTML .= '<b>To add the <a href="/faq.php#package" TITLE="what is a package?">package</a>:</b> <code class="code">pkg install ' . $port->category . '/' . $port->port . '</code></p>';
                 }
             }
         }
         $HTML .= "\n<hr>\n";
     }
     if ($this->ShowDescriptionShort && ($this->ShowDescriptionLink || $this->ShowEverything)) {
         // Long description
         $HTML .= '<A HREF="/' . $port->category . '/' . $port->port . '/">Description</a>';
         $HTML .= ' <b>:</b> ';
     }
     if ($this->ShowEverything) {
         $HTML .= "<b>Configuration Options</b>\n<pre>";
         if ($port->showconfig) {
             $HTML .= $port->showconfig;
         } else {
             $HTML .= '     No options to configure';
         }
         $HTML .= "</pre>\n<hr>\n";
     }
     if ($this->ShowEverything && $port->uses) {
         $HTML .= "<b>USES:</b>\n<pre>";
         $HTML .= $port->uses;
         $HTML .= "</pre>\n<hr>\n";
     }
     if ($this->ShowEverything || $this->ShowMasterSites) {
         $HTML .= '<b>Master Sites:</b>' . "\n" . '<ol class="mastersites" id="mastersites">' . "\n";
         $MasterSites = explode(' ', $port->master_sites);
         asort($MasterSites);
         foreach ($MasterSites as $Site) {
             $HTML .= '<li>' . htmlify(_forDisplay($Site)) . "</li>\n";
         }
         $HTML .= "</ol>\n";
         #			$HTML .= '<br>';
     }
     #		$HTML .= "\n<hr>\n";
     $HTML .= "\n</DD>\n";
     $HTML .= "</DL>\n";
     return $HTML;
 }
예제 #2
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;
}