Move package info pages to template

This commit is contained in:
Peter Kokot
2019-01-27 13:03:02 +01:00
parent 64788955cf
commit 6b9833ed9f
11 changed files with 677 additions and 872 deletions

View File

@@ -175,4 +175,12 @@ $container->set(App\Utils\DependenciesFixer::class, function ($c) {
return new App\Utils\DependenciesFixer($c->get(App\Database::class));
});
$container->set(App\Utils\Licenser::class, function ($c) {
return new App\Utils\Licenser();
});
$container->set(App\Utils\Breadcrumbs::class, function ($c) {
return new App\Utils\Breadcrumbs($c->get(App\Database::class));
});
return $container;

View File

@@ -389,42 +389,6 @@ function error_handler($errobj, $title = 'Error')
exit;
}
/**
* prints "urhere" menu bar
* Top Level :: XML :: XML_RPC
* @param bool $link_lastest If the last category should or not be a link
*/
function html_category_urhere($id, $link_lastest = false)
{
global $database;
$html = "<a href=\"/packages.php\">Top Level</a>";
if ($id !== null) {
$results = $database->run("SELECT c.id, c.name
FROM categories c, categories cat
WHERE cat.id = :id
AND c.cat_left <= cat.cat_left
AND c.cat_right >= cat.cat_right", [':id' => $id])->fetchAll();
$nrows = count($results);
$i = 0;
foreach ($results as $row) {
if (!$link_lastest && $i >= $nrows -1) {
break;
}
$html .= ' :: <a href="/packages.php?catpid='.$row['id'].'&catname='.$row['name'].'">'.$row['name'].'</a>';
$i++;
}
if (!$link_lastest) {
$html .= ' :: <b>'.$row['name'].'</b>';
}
}
print $html;
}
/**
* Redirects to the given full or partial URL. This function does not return.
*

View File

@@ -277,14 +277,17 @@ div.success ul {
a:link, a:visited {
color: #000066;
display: inline-block;
}
a:hover {
color: #000033;
display: inline-block;
}
a:active {
color: #cc00cc;
display: inline-block;
}
th.others {

108
public_html/extension.php Normal file
View File

@@ -0,0 +1,108 @@
<?php
/*
+----------------------------------------------------------------------+
| The PECL website |
+----------------------------------------------------------------------+
| Copyright (c) 1999-2019 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| https://php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Martin Jansen <mj@php.net> |
| Tomas V.V.Cox <cox@idecnet.com> |
+----------------------------------------------------------------------+
*/
/**
* Page for displaying given PECL extension information for *nix and Windows
* builds.
*
* This front controller is included in package-info.php and
* package-info-win.php files due to Apache configuration on production where
* they can't be changed so often.
*/
use App\Utils\Licenser;
use App\PackageDll;
use App\Repository\PackageRepository;
use App\Repository\ReleaseRepository;
use App\Repository\UserRepository;
use App\Utils\Breadcrumbs;
require_once __DIR__.'/../include/pear-prepend.php';
$packageNameOrId = filter_has_var(INPUT_GET, 'package') ? filter_input(INPUT_GET, 'package', FILTER_SANITIZE_STRING) : '';
$version = filter_has_var(INPUT_GET, 'version') ? filter_input(INPUT_GET, 'version', FILTER_SANITIZE_STRING) : '';
$windows = isset($windows) ? true : false;
if (is_numeric($packageNameOrId)) {
$packageNameOrId = (int) $packageNameOrId;
}
$packageRepository = $container->get(PackageRepository::class);
$package = $packageRepository->find($packageNameOrId);
if (
'' === $packageNameOrId
|| !isset($package['name'])
|| ('' !== $version && !isset($package['releases'][$version]))
) {
$_SERVER['REDIRECT_URL'] = $_SERVER['REQUEST_URI'];
header('HTTP/1.0 404 Not Found');
include __DIR__.'/error/404.php';
exit();
}
if ('' !== $version && isset($package['releases'][$version])) {
$releaseId = $package['releases'][$version]['id'];
// Find correct version for the release id
foreach ($package['releases'] as $release) {
if ($release['id'] == $releaseId) {
break;
}
}
} else {
$releaseId = null;
$release = null;
}
$packageDll = $container->get(PackageDll::class);
if ($windows && '' !== $version) {
$urls = $packageDll->getDllDownloadUrls($package['name'], $version, $package['releases'][$version]['releasedate']);
} else {
$urls = [];
}
$template->register('findPackage', function($name) use ($packageRepository) {
return $packageRepository->findOneByName($name);
});
$template->register('makeNiceLinkNameFromZipName', function ($url) use ($packageDll) {
return $packageDll->makeNiceLinkNameFromZipName(basename($url));
});
echo $template->render('pages/extension.php', [
'package' => $package,
'version' => $version,
'breadcrumbs' => $container->get(Breadcrumbs::class)->getBreadcrumbs($package['categoryid'], true),
'releaseId' => $releaseId,
'maintainers' => $container->get(UserRepository::class)->findMaintainersByPackageId($package['packageid']),
'license' => $container->get(Licenser::class)->getHtml($package['license']),
'downloads' => $container->get(ReleaseRepository::class)->findDownloads($package['packageid']),
'unmaintained' => (bool) $package['unmaintained'],
'superseded' => !empty($package['new_channel']) ? true : (bool) $package['new_package'],
'packageDll' => $packageDll,
'dependants' => $packageRepository->findDependants($package['name']),
'host' => $container->get('host'),
'windows' => $windows,
'release' => $release,
'urls' => $urls,
]);

View File

@@ -19,436 +19,6 @@
+----------------------------------------------------------------------+
*/
use App\BorderBox;
use App\Utils\Licenser;
use App\PackageDll;
use App\Repository\PackageRepository;
use App\Repository\UserRepository;
$windows = true;
$licenser = new Licenser();
$packageDll = $container->get(PackageDll::class);
$package = filter_input(INPUT_GET, 'package', FILTER_SANITIZE_STRING);
$version = filter_input(INPUT_GET, 'version', FILTER_SANITIZE_STRING);
$relid = filter_input(INPUT_GET, FILTER_VALIDATE_INT);
if (!$package) {
$_SERVER['REDIRECT_URL'] = $_SERVER['REQUEST_URI'];
header('HTTP/1.0 404 Not Found');
include 'error/404.php';
exit();
}
if (is_numeric($package)) {
$package = (int)$package;
}
// Package data
$pkg = $packageEntity->info($package);
$relid = FALSE;
if (!empty($version)) {
foreach ($pkg['releases'] as $ver => $release) {
if ($ver == $version) {
$relid = $release['id'];
break;
}
}
}
/* Sanity check&cleanup if given version does not exist */
if ($relid === FALSE) {
$version = FALSE;
}
if (empty($package) || !isset($pkg['name'])) {
$_SERVER['REDIRECT_URL'] = $_SERVER['REQUEST_URI'];
header('HTTP/1.0 404 Not Found');
include 'error/404.php';
exit();
}
$name = $pkg['name'];
$summary = stripslashes($pkg['summary']);
$license = $pkg['license'];
$description = stripslashes($pkg['description']);
$category = $pkg['category'];
$homepage = $pkg['homepage'];
$pacid = $pkg['packageid'];
$cvs_link = $pkg['cvs_link'];
$doc_link = $pkg['doc_link'];
$bug_link = $pkg['bug_link'];
$unmaintained = ($pkg['unmaintained'] ? 'Y' : 'N');
$superseded = ((bool) $pkg['new_package'] ? 'Y' : 'N');
$moved_out = (!empty($pkg['new_channel']) ? TRUE : FALSE);
if ($moved_out) {
$superseded = 'Y';
}
// Maintainers data
$userRepository = new UserRepository($database);
$accounts = '';
foreach ($userRepository->findMaintainersByPackageId($pacid) as $row) {
$accounts .= "{$row['name']}";
if ($row['showemail'] == 1) {
$accounts .= " &lt;<a href=\"mailto:{$row['email']}\">{$row['email']}</a>&gt;";
}
$accounts .= " ({$row['role']})";
if (!empty($row['wishlist'])) {
$accounts .= " [<a href=\"/wishlist.php/{$row['handle']}\">wishlist</a>]";
}
$accounts .= " [<a href=\"/user/{$row['handle']}\">details</a>]<br />";
}
$downloads = [];
if (!$relid) {
$statement = $database->run("SELECT f.id AS `id`, f.release AS `release`,".
" f.platform AS platform, f.format AS format,".
" f.md5sum AS md5sum, f.basename AS basename,".
" f.fullpath AS fullpath, r.version AS version".
" FROM files f, releases r".
" WHERE f.package = :package_id AND f.release = r.id", [
':package_id' => $pacid
]);
foreach ($statement->fetchAll() as $row) {
$downloads[$row['version']][] = $row;
}
}
// page header
if ($version) {
response_header("Package :: $name :: $version");
} else {
response_header("Package :: $name");
}
html_category_urhere($pkg['categoryid'], true);
if ($relid) {
echo ' :: <a href="/package/'.$name.'">'.$name.'</a> :: <b>Windows</b>';
}
print "<h2 align=\"center\">$name";
if ($version) {
print " $version";
}
print "</h2>\n";
// Supeseded checks
$dec_messages = [
'abandoned' => 'This package is not maintained anymore and has been superseded.',
'superseded' => 'This package has been superseded, but is still maintained for bugs and security fixes.',
'unmaintained' => 'This package is not maintained, if you would like to take over please go to <a href="/takeover.php">this page</a>.'
];
$dec_table = [
'abandoned' => ['superseded' => 'Y', 'unmaintained' => 'Y'],
'superseded' => ['superseded' => 'Y', 'unmaintained' => 'N'],
'unmaintained' => ['superseded' => 'N', 'unmaintained' => 'Y'],
];
$apply_rule = null;
foreach ($dec_table as $rule => $conditions) {
$match = true;
foreach ($conditions as $condition => $value) {
if ($$condition != $value) {
$match = false;
break;
}
}
if ($match) {
$apply_rule = $rule;
}
}
if (!is_null($apply_rule) && isset($dec_messages[$apply_rule])) {
$str = '<div class="warnings">';
$str .= $dec_messages[$apply_rule];
if ($pkg['new_channel'] == $config->get('host')) {
$str .= ' Use <a href="/package/' . $pkg['new_package'] .
'">' . htmlspecialchars($pkg['new_package']) . '</a> instead.';
} elseif ($pkg['new_channel']) {
$str .= ' Package has moved to channel <a href="' . $pkg['new_channel'] .
'">' . htmlspecialchars($pkg['new_channel']) . '</a>, package ' .
$pkg['new_package'] . '.';
}
$str .= '</div>';
echo $str;
}
// Package Information box
$bb = new BorderBox("Package Information", "90%", "", 2, true);
$bb->horizHeadRow("Summary", $summary);
$bb->horizHeadRow("Maintainers", $accounts);
$bb->horizHeadRow("License", $licenser->getHtml($license));
$bb->horizHeadRow("Description", nl2br($description));
if (!empty($homepage)) {
$bb->horizHeadRow("Homepage", '<a href="'.$homepage.'">'.$homepage.'</a>');
}
if ($relid) {
// Find correct version for given release id
foreach ($pkg['releases'] as $r_version => $release) {
if ($release['id'] != $relid) {
continue;
}
$bb->horizHeadRow("Release notes<br />Version " . $version . "<br />(" . $release['state'] . ")", nl2br($release['releasenotes']));
break;
}
}
if (!empty($auth_user)) {
$bb->fullRow("<div align=\"right\">" .
'<a href="/package-edit.php?id='.$pacid.'">'.
'<img src="/img/edit.gif" alt="Edit package information"></a>'.
($auth_user->isAdmin() ? '&nbsp;<a href="/package-delete.php?id='.$pacid.'">'.
'<img src="/img/delete.gif" alt="Delete package"></a>' : '').
'&nbsp;[<a href="/admin/package-maintainers.php?pid='.$pacid.'">Edit maintainers</a>]</div>');
}
$bb->end();
// DLL List
echo '<div>&nbsp;</div>';
if ($version) {
$bb = new BorderBox("DLL List", "90%", "", 2, true);
$urls = $packageDll->getDllDownloadUrls($pkg['name'], $version, $pkg['releases'][$version]['releasedate']);
if (!$urls) {
$bb->fullRow("No DLL available");
} else {
foreach ($urls as $desc => $set) {
$links = [];
foreach ($set as $url) {
$link_txt = $packageDll->makeNiceLinkNameFromZipName(basename($url));
$links[] = "<a href=\"$url\">$link_txt</a>";
}
$bb->horizHeadRow("PHP $desc", implode("<br/>", $links));
}
}
$bb->end();
}
// latest/cvs/changelog links
?>
<br />
<table border="0" cellspacing="3" cellpadding="3" height="48" width="90%" align="center">
<tr>
<?php
$get_link = '<a href="/get/'.$name.'">Latest Tarball</a>';
if ($version) {
$changelog_link = '<a href="/package-changelog.php?package='.$pkg['name'].'&amp;release='.$version.'">Changelog</a>';
} else {
$changelog_link = '<a href="/package-changelog.php?package='.$pkg['name'].'">Changelog</a>';
}
$stats_link = '<a href="/package-stats.php?pid='.$pacid.'&amp;rid=&amp;cid='.$pkg['categoryid'].'">View Statistics</a>';
?>
<td align="center">[ <?php print $get_link; ?> ]</td>
<td align="center">[ <?php print $changelog_link; ?> ]</td>
<td align="center">[ <?php print $stats_link; ?> ]</td>
</tr>
<tr>
<td align="center">
<?php
if (!empty($cvs_link)) {
print '[ <a href="'.$cvs_link.'" target="_blank">Browse Source</a> ]';
}
print '&nbsp;</td>';
if (!empty($bug_link)) {
print '<td align="center">[ <a href="'.$bug_link.'">Package Bugs</a> ]</td>';
} else {
print '<td align="center">[ <a href="https://bugs.php.net/search.php?cmd=display&status=Open&package_name[]='.$pkg['name'].'">Package Bugs</a> ]</td>';
}
if (!empty($doc_link)) {
print '<td align="center">[ <a href="'.$doc_link.'">View Documentation</a> ]</td>';
} else {
print '<td />';
}
?>
</tr>
<?php
if (empty($bug_link)) {
?>
<tr>
<td align="center">[ <a href="https://bugs.php.net/report.php?package=<?= $pkg['name']; ?>">Report new bug</a> ]</td>
</tr>
<?php
}
?>
</table>
<br />
<?php
// Available Releases
if (!$relid) {
$bb = new BorderBox("Available Releases", "90%", "", 5, true);
if (count($pkg['releases']) == 0) {
print "<i>No releases for this package.</i>";
} else {
$bb->headRow("Version", "State", "Release Date", "Downloads", "");
foreach ($pkg['releases'] as $r_version => $r) {
if (empty($r['state'])) {
$r['state'] = 'devel';
}
$r['releasedate'] = substr($r['releasedate'], 0, 10);
$dl = $downloads[$r_version];
$downloads_html = '';
foreach ($downloads[$r_version] as $dl) {
$downloads_html .= "<a href=\"/get/$dl[basename]\">".
"$dl[basename]</a> (".sprintf("%.1fkB",@filesize($dl['fullpath'])/1024.0).")";
$urls = $packageDll->getDllDownloadUrls($pkg['name'], $r_version, $pkg['releases'][$r_version]['releasedate']);
if ($urls) {
$downloads_html .= "&nbsp;&nbsp;<a href=\"/package/$pkg[name]/$r_version/windows\">"
. "<img src=\"/img/windows-icon.png\" />DLL</a>";
}
}
$link_changelog = '<small>[<a href="/package-changelog.php?package='.$pkg['name'].'&release='.$r_version.'">Changelog</a>]</small>';
$href_release = "/package/" . $pkg['name'] . "/" . $r_version;
$bb->horizHeadRow(
'<a href="'.$href_release.'">'.$r_version.'</a>',
$r['state'],
$r['releasedate'],
$downloads_html,
$link_changelog
);
}
}
$bb->end();
print "<br /><br />\n";
}
// Dependencies
$title = "Dependencies";
if ($relid) {
$title .= " for release $version";
}
$bb = new BorderBox($title, "90%", "", 2, true);
$rels = $pkg['releases'];
// Check if there are too much things to show
$too_much = false;
if (count ($rels) > 3) {
$too_much = true;
$rels = array_slice($rels, 0, 3);
}
if (empty($downloads) && !$relid) {
print "<i>No releases yet.</i>";
} else {
$rel_trans = [
'lt' => 'older than %s',
'le' => 'version %s or older',
'eq' => 'version %s',
'ne' => 'any version but %s',
'gt' => 'newer than %s',
'ge' => '%s or newer',
];
$dep_type_desc = [
'pkg' => 'PEAR Package',
'pkg_pecl' => 'PECL Package',
'ext' => 'PHP Extension',
'php' => 'PHP Version',
'prog' => 'Program',
'ldlib' => 'Development Library',
'rtlib' => 'Runtime Library',
'os' => 'Operating System',
'websrv' => 'Web Server',
'sapi' => 'SAPI Backend',
];
// Loop per version
foreach ($rels as $r_version => $rel) {
$dep_text = "";
if (!empty($version) && $r_version != $version) {
continue;
}
if (empty($version)) {
$title = "Release " . $r_version . ":";
} else {
$title = "";
}
$deps = $pkg['releases'][$r_version]['deps'];
if (count($deps) > 0) {
foreach ($deps as $row) {
// we have PEAR installer deps both with the name of PEAR Installer and PEAR, make it consistent here until it is fixed in the db
if ($row['name'] == 'PEAR Installer') {
$row['name'] = 'PEAR';
}
// fix up wrong dep types here, until it is fixed in the db, we only have the pecl packages in the db now
if ($row['type'] == 'pkg' && $database->run("SELECT id, package_type FROM packages WHERE name = ?", [$row['name']])->fetch()) {
$row['type'] = 'pkg_pecl';
}
if ($row['type'] == 'pkg_pecl') {
$dep_name_html = sprintf('<a href="/package/%s">%s</a>', $row['name'], $row['name']);
}
elseif ($row['type'] == 'pkg') {
$dep_name_html = sprintf('<a href="https://pear.php.net/package/%s">%s</a>', $row['name'], $row['name']);
}
else {
$dep_name_html = $row['name'];
}
if (isset($rel_trans[$row['relation']])) {
$rel = sprintf($rel_trans[$row['relation']], $row['version']);
$dep_text .= sprintf("%s: %s %s",
$dep_type_desc[$row['type']], $dep_name_html, $rel);
} else {
$dep_text .= sprintf("%s: %s", $dep_type_desc[$row['type']], $dep_name_html);
}
$dep_text .= "<br />";
}
$bb->horizHeadRow($title, $dep_text);
} else {
$bb->horizHeadRow($title, "No dependencies registered.");
}
}
if ($too_much && empty($version)) {
$bb->fullRow("Dependencies for older releases can be found on the release overview page.");
}
}
$bb->end();
// Dependants
$dependants = $container->get(PackageRepository::class)->findDependants($name);
if (count($dependants) > 0) {
echo "<br /><br />";
$bb = new BorderBox("Packages that depend on " . $name);
foreach ($dependants as $dep) {
$bb->plainRow('<a href="/package/'.$dep['p_name'].'">'.$dep['p_name'].'</a>');
}
$bb->end();
}
response_footer();
require_once __DIR__.'/extension.php';

View File

@@ -19,406 +19,4 @@
+----------------------------------------------------------------------+
*/
use App\BorderBox;
use App\Utils\Licenser;
use App\PackageDll;
use App\Repository\PackageRepository;
use App\Repository\UserRepository;
$licenser = new Licenser();
$packageDll = $container->get(PackageDll::class);
$package = filter_input(INPUT_GET, 'package', FILTER_SANITIZE_STRING);
$version = filter_input(INPUT_GET, 'version', FILTER_SANITIZE_STRING);
$relid = filter_input(INPUT_GET, FILTER_VALIDATE_INT);
if (!$package) {
$_SERVER['REDIRECT_URL'] = $_SERVER['REQUEST_URI'];
header('HTTP/1.0 404 Not Found');
include 'error/404.php';
exit();
}
if (is_numeric($package)) {
$package = (int)$package;
}
// Package data
$pkg = $packageEntity->info($package);
if (!empty($version)) {
foreach ($pkg['releases'] as $ver => $release) {
if ($ver == $version) {
$relid = $release['id'];
break;
}
}
}
if (empty($package) || !isset($pkg['name'])) {
$_SERVER['REDIRECT_URL'] = $_SERVER['REQUEST_URI'];
header('HTTP/1.0 404 Not Found');
include 'error/404.php';
exit();
}
$name = $pkg['name'];
$summary = stripslashes($pkg['summary']);
$license = $pkg['license'];
$description = stripslashes($pkg['description']);
$category = $pkg['category'];
$homepage = $pkg['homepage'];
$pacid = $pkg['packageid'];
$cvs_link = $pkg['cvs_link'];
$doc_link = $pkg['doc_link'];
$bug_link = $pkg['bug_link'];
$unmaintained = ($pkg['unmaintained'] ? 'Y' : 'N');
$superseded = ((bool) $pkg['new_package'] ? 'Y' : 'N');
$moved_out = (!empty($pkg['new_channel']) ? TRUE : FALSE);
if ($moved_out) {
$superseded = 'Y';
}
// Maintainers data
$userRepository = new UserRepository($database);
$accounts = '';
foreach ($userRepository->findMaintainersByPackageId($pacid) as $row) {
$accounts .= "{$row['name']}";
if ($row['showemail'] == 1) {
$accounts .= " &lt;<a href=\"mailto:{$row['email']}\">{$row['email']}</a>&gt;";
}
$accounts .= " ({$row['role']})";
if (!empty($row['wishlist'])) {
$accounts .= " [<a href=\"/wishlist.php/{$row['handle']}\">wishlist</a>]";
}
$accounts .= " [<a href=\"/user/{$row['handle']}\">details</a>]<br />";
}
$downloads = [];
if (!$relid) {
$statement = $database->run("SELECT f.id AS `id`, f.release AS `release`,".
" f.platform AS platform, f.format AS format,".
" f.md5sum AS md5sum, f.basename AS basename,".
" f.fullpath AS fullpath, r.version AS version".
" FROM files f, releases r".
" WHERE f.package = :package_id AND f.release = r.id", [
':package_id' => $pacid
]);
foreach ($statement->fetchAll() as $row) {
$downloads[$row['version']][] = $row;
}
}
// page header
if ($version) {
response_header("Package :: $name :: $version");
} else {
response_header("Package :: $name");
}
html_category_urhere($pkg['categoryid'], true);
if ($relid) {
echo ' :: <a href="/package/'.$name.'">'.$name.'</a>';
}
print "<h2 align=\"center\">$name";
if ($version) {
print " $version";
}
print "</h2>\n";
// Supeseded checks
$dec_messages = [
'abandoned' => 'This package is not maintained anymore and has been superseded.',
'superseded' => 'This package has been superseded, but is still maintained for bugs and security fixes.',
'unmaintained' => 'This package is not maintained, if you would like to take over please go to <a href="/takeover.php">this page</a>.'
];
$dec_table = [
'abandoned' => ['superseded' => 'Y', 'unmaintained' => 'Y'],
'superseded' => ['superseded' => 'Y', 'unmaintained' => 'N'],
'unmaintained' => ['superseded' => 'N', 'unmaintained' => 'Y'],
];
$apply_rule = null;
foreach ($dec_table as $rule => $conditions) {
$match = true;
foreach ($conditions as $condition => $value) {
if ($$condition != $value) {
$match = false;
break;
}
}
if ($match) {
$apply_rule = $rule;
}
}
if (!is_null($apply_rule) && isset($dec_messages[$apply_rule])) {
$str = '<div class="warnings">';
$str .= $dec_messages[$apply_rule];
if ($pkg['new_channel'] == $config->get('host')) {
$str .= ' Use <a href="/package/' . $pkg['new_package'] .
'">' . htmlspecialchars($pkg['new_package']) . '</a> instead.';
} elseif ($pkg['new_channel']) {
$str .= ' Package has moved to channel <a href="' . $pkg['new_channel'] .
'">' . htmlspecialchars($pkg['new_channel']) . '</a>, package ' .
$pkg['new_package'] . '.';
}
$str .= '</div>';
echo $str;
}
// Package Information box
$bb = new BorderBox("Package Information", "90%", "", 2, true);
$bb->horizHeadRow("Summary", $summary);
$bb->horizHeadRow("Maintainers", $accounts);
$bb->horizHeadRow("License", $licenser->getHtml($license));
$bb->horizHeadRow("Description", nl2br($description));
if (!empty($homepage)) {
$bb->horizHeadRow("Homepage", '<a href="'.$homepage.'">'.$homepage.'</a>');
}
if ($relid) {
// Find correct version for given release id
foreach ($pkg['releases'] as $r_version => $release) {
if ($release['id'] != $relid) {
continue;
}
$bb->horizHeadRow("Release notes<br />Version " . $version . "<br />(" . $release['state'] . ")", nl2br($release['releasenotes']));
break;
}
}
if (!empty($auth_user)) {
$bb->fullRow("<div align=\"right\">" .
'<a href="/package-edit.php?id='.$pacid.'">'.
'<img src="/img/edit.gif" alt="Edit package information"></a>'.
($auth_user->isAdmin() ? '&nbsp;<a href="/package-delete.php?id='.$pacid.'">'.
'<img src="/img/delete.gif" alt="Delete package"></a>' : '').
'&nbsp;[<a href="/admin/package-maintainers.php?pid='.$pacid.'">Edit maintainers</a>]</div>');
}
$bb->end();
// latest/cvs/changelog links
?>
<br />
<table border="0" cellspacing="3" cellpadding="3" height="48" width="90%" align="center">
<tr>
<?php
$get_link = '<a href="/get/'.$name.'">Latest Tarball</a>';
if ($version) {
$changelog_link = '<a href="/package-changelog.php?package='.$pkg['name'].'&amp;release='.$version.'">Changelog</a>';
} else {
$changelog_link = '<a href="/package-changelog.php?package='.$pkg['name'].'">Changelog</a>';
}
$stats_link = '<a href="/package-stats.php?pid='.$pacid.'&amp;rid=&amp;cid='.$pkg['categoryid'].'">View Statistics</a>';
?>
<td align="center">[ <?php print $get_link; ?> ]</td>
<td align="center">[ <?php print $changelog_link; ?> ]</td>
<td align="center">[ <?php print $stats_link; ?> ]</td>
</tr>
<tr>
<td align="center">
<?php
if (!empty($cvs_link)) {
print '[ <a href="'.$cvs_link.'" target="_blank">Browse Source</a> ]';
}
print '&nbsp;</td>';
if (!empty($bug_link)) {
print '<td align="center">[ <a href="'.$bug_link.'">Package Bugs</a> ]</td>';
} else {
print '<td align="center">[ <a href="https://bugs.php.net/search.php?cmd=display&status=Open&package_name[]='.$pkg['name'].'">Package Bugs</a> ]</td>';
}
if (!empty($doc_link)) {
print '<td align="center">[ <a href="'.$doc_link.'">View Documentation</a> ]</td>';
} else {
print '<td />';
}
?>
</tr>
<?php
if (empty($bug_link)) {
?>
<tr>
<td align="center">[ <a href="https://bugs.php.net/report.php?package=<?= $pkg['name']; ?>">Report new bug</a> ]</td>
</tr>
<?php
}
?>
</table>
<br />
<?php
// Available Releases
if (!$relid) {
$bb = new BorderBox("Available Releases", "90%", "", 5, true);
if (count($pkg['releases']) == 0) {
print "<i>No releases for this package.</i>";
} else {
$bb->headRow("Version", "State", "Release Date", "Downloads", "");
foreach ($pkg['releases'] as $r_version => $r) {
if (empty($r['state'])) {
$r['state'] = 'devel';
}
$r['releasedate'] = substr($r['releasedate'], 0, 10);
$dl = $downloads[$r_version];
$downloads_html = '';
foreach ($downloads[$r_version] as $dl) {
$downloads_html .= "<a href=\"/get/$dl[basename]\">".
"$dl[basename]</a> (".sprintf("%.1fkB",@filesize($dl['fullpath'])/1024.0).")";
$urls = $packageDll->getDllDownloadUrls($pkg['name'], $r_version, $pkg['releases'][$r_version]['releasedate']);
if ($urls) {
$downloads_html .= "&nbsp;&nbsp;<a href=\"/package/$pkg[name]/$r_version/windows\">"
. "<img src=\"/img/windows-icon.png\" />DLL</a>";
}
}
$link_changelog = '<small>[<a href="/package-changelog.php?package='.$pkg['name'].'&release='.$r_version.'">Changelog</a>]</small>';
$href_release = "/package/" . $pkg['name'] . "/" . $r_version;
$bb->horizHeadRow(
'<a href="'.$href_release.'">'.$r_version.'</a>',
$r['state'],
$r['releasedate'],
$downloads_html,
$link_changelog
);
}
}
$bb->end();
print "<br /><br />\n";
}
// Dependencies
$title = "Dependencies";
if ($relid) {
$title .= " for release $version";
}
$bb = new BorderBox($title, "90%", "", 2, true);
$rels = $pkg['releases'];
// Check if there are too much things to show
$too_much = false;
if (count ($rels) > 3) {
$too_much = true;
$rels = array_slice($rels, 0, 3);
}
if (empty($downloads) && !$relid) {
print "<i>No releases yet.</i>";
} else {
$rel_trans = [
'lt' => 'older than %s',
'le' => 'version %s or older',
'eq' => 'version %s',
'ne' => 'any version but %s',
'gt' => 'newer than %s',
'ge' => '%s or newer',
];
$dep_type_desc = [
'pkg' => 'PEAR Package',
'pkg_pecl' => 'PECL Package',
'ext' => 'PHP Extension',
'php' => 'PHP Version',
'prog' => 'Program',
'ldlib' => 'Development Library',
'rtlib' => 'Runtime Library',
'os' => 'Operating System',
'websrv' => 'Web Server',
'sapi' => 'SAPI Backend',
];
// Loop per version
foreach ($rels as $r_version => $rel) {
$dep_text = "";
if (!empty($version) && $r_version != $version) {
continue;
}
if (empty($version)) {
$title = "Release " . $r_version . ":";
} else {
$title = "";
}
$deps = $pkg['releases'][$r_version]['deps'];
if (count($deps) > 0) {
foreach ($deps as $row) {
// we have PEAR installer deps both with the name of PEAR Installer and PEAR, make it consistent here until it is fixed in the db
if ($row['name'] == 'PEAR Installer') {
$row['name'] = 'PEAR';
}
// fix up wrong dep types here, until it is fixed in the db, we only have the pecl packages in the db now
if ($row['type'] == 'pkg' && $database->run("SELECT id, package_type FROM packages WHERE name = ?", [$row['name']])->fetch()) {
$row['type'] = 'pkg_pecl';
}
if ($row['type'] == 'pkg_pecl') {
$dep_name_html = sprintf('<a href="/package/%s">%s</a>', $row['name'], $row['name']);
} elseif ($row['type'] == 'pkg') {
$dep_name_html = sprintf('<a href="https://pear.php.net/package/%s">%s</a>', $row['name'], $row['name']);
} else {
$dep_name_html = $row['name'];
}
if (isset($rel_trans[$row['relation']])) {
$rel = sprintf($rel_trans[$row['relation']], $row['version']);
$dep_text .= sprintf("%s: %s %s",
$dep_type_desc[$row['type']], $dep_name_html, $rel);
} else {
$dep_text .= sprintf("%s: %s", $dep_type_desc[$row['type']], $dep_name_html);
}
$dep_text .= "<br />";
}
$bb->horizHeadRow($title, $dep_text);
} else {
$bb->horizHeadRow($title, "No dependencies registered.");
}
}
if ($too_much && empty($version)) {
$bb->fullRow("Dependencies for older releases can be found on the release overview page.");
}
}
$bb->end();
// Dependants
$dependants = $container->get(PackageRepository::class)->findDependants($name);
if (count($dependants) > 0) {
echo "<br /><br />";
$bb = new BorderBox("Packages that depend on " . $name);
foreach ($dependants as $dep) {
$bb->plainRow('<a href="/package/"'.$dep['p_name'].'">'.$dep['p_name'].'</a>');
}
$bb->end();
}
response_footer();
require_once __DIR__.'/extension.php';

View File

@@ -24,6 +24,7 @@
* o Make headers in package list clickable for ordering
*/
use App\Utils\Breadcrumbs;
use App\Utils\Pagination;
$script_name = htmlspecialchars($_SERVER['SCRIPT_NAME'], ENT_QUOTES);
@@ -278,5 +279,7 @@ if ($moreinfo) {
$hideMoreInfoLink = '#';
}
$breadcrumbs = $container->get(Breadcrumbs::class)->getBreadcrumbs($catpid, false);
// Template
include __DIR__.'/../templates/packages.php';

View File

@@ -186,4 +186,32 @@ class ReleaseRepository
return $this->database->run($sql, $arguments)->fetchAll();
}
/**
* Find all releases for download by given package id grouped in an array by
* release version.
*
* @param int $packageId ID of the package.
*
* @return array
*/
public function findDownloads($packageId)
{
$sql = "SELECT f.id AS `id`, f.release AS `release`,
f.platform AS platform, f.format AS format,
f.md5sum AS md5sum, f.basename AS basename,
f.fullpath AS fullpath, r.version AS version
FROM files f, releases r
WHERE f.package = :package_id AND f.release = r.id
";
$statement = $this->database->run($sql, [':package_id' => $packageId]);
$downloads = [];
foreach ($statement->fetchAll() as $row) {
$downloads[$row['version']][] = $row;
}
return $downloads;
}
}

67
src/Utils/Breadcrumbs.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
namespace App\Utils;
use App\Database;
/**
* Breadcrumbs generator for packages and categories.
*/
class Breadcrumbs
{
/**
* Database handler.
*
* @var Database
*/
private $database;
/**
* Class constructor.
*/
public function __construct(Database $database)
{
$this->database = $database;
}
/**
* Get breadcrumbs for categories and packages.
* Top Level :: Multimedia :: Audio :: FliteTTS
*
* @param int $id
* @param bool $isLastLink If the last category should or not be a link
* @return string
*/
public function getBreadcrumbs($id, $isLastLink = false)
{
$html = '<a href="/packages.php">Top Level</a>';
if (null !== $id) {
$sql = "SELECT c.id, c.name
FROM categories c, categories cat
WHERE cat.id = :id
AND c.cat_left <= cat.cat_left
AND c.cat_right >= cat.cat_right
";
$results = $this->database->run($sql, [':id' => $id])->fetchAll();
$nrows = count($results);
$i = 0;
foreach ($results as $row) {
if (!$isLastLink && $i >= $nrows -1) {
break;
}
$html .= ' :: <a href="/packages.php?catpid='.$row['id'].'&catname='.$row['name'].'">'.$row['name'].'</a>';
$i++;
}
if (!$isLastLink) {
$html .= ' :: <b>'.$row['name'].'</b>';
}
}
return $html;
}
}

View File

@@ -43,7 +43,7 @@
<table border="0" width="100%">
<tr>
<th valign="top" align="left">
Contents of :: <?php html_category_urhere($catpid, false); ?>
Contents of :: <?= $breadcrumbs ?>
</th>
<td valign="top" align="right">
<?php echo $showempty_link; ?>

View File

@@ -0,0 +1,456 @@
<?php $this->extend('layout.php', ['title' => 'Package :: '.$package['name'].($version ? ' '.$version : '').($windows ? ' for Windows' : '')]) ?>
<?php $this->start('content') ?>
<?= $breadcrumbs ?>
<?php if (!empty($releaseId)): ?>
:: <a href="/package/<?= $this->e($package['name']) ?>"><?= $this->e($package['name']) ?></a>
<?php else: ?>
:: <?= $this->e($package['name']) ?>
<?php endif ?>
<?php if (!empty($version)): ?>
:: <a href="/package/<?= $this->e($package['name']) ?>/<?= $this->e($version) ?>"><?= $this->e($version) ?></a>
<?php endif ?>
<?php if (!empty($windows)): ?>
:: Windows
<?php endif ?>
<h2 style="text-align:center">
<?= $this->e($package['name']) ?>
<?= !empty($version) ? $this->e($version) : '' ?>
<?= $windows ? ' for Windows' : '' ?>
</h2>
<?php if ($superseded || $unmaintained): ?>
<div class="warnings">
<?php if ($superseded && $unmaintained): ?>
This package is not maintained anymore and has been superseded.
<?php elseif ($superseded && !$unmaintained): ?>
This package has been superseded, but is still maintained for bugs and security fixes.
<?php elseif (!$superseded && $unmaintained): ?>
This package is not maintained, if you would like to take over please go to <a href="/takeover.php">this page</a>.
<?php endif ?>
<?php if ($package['new_channel'] === $host): ?>
Use <a href="/package/<?= $this->noHtml($package['new_package']) ?>">
<?= $this->noHtml($package['new_package']) ?></a> instead.
<?php elseif ($package['new_channel']): ?>
Package has moved to channel <a href="<?= $this->e($package['new_channel']) ?>">
<?= $this->e($package['new_channel']) ?></a>
<?php if ($package['new_package']): ?>
package <?= $this->e($package['new_package']) ?>.
<?php endif ?>
<?php endif ?>
</div>
<?php endif ?>
<table cellpadding="0" cellspacing="1" style="width: 90%; border: 0px;">
<tr>
<td style="background-color: #000000">
<table cellpadding="2" cellspacing="1" style="width: 100%; border: 0px;">
<tr style="background-color: #CCCCCC;">
<th colspan="2">Package Information</th>
</tr>
<tr>
<th valign="top" style="background-color: #cccccc">Summary</th>
<td valign="top" style="background-color: #e8e8e8"><?= $this->e($package['summary']) ?></td>
</tr>
<tr>
<th valign="top" style="background-color: #cccccc">Maintainers</th>
<td valign="top" style="background-color: #e8e8e8">
<?php foreach ($maintainers as $maintainer): ?>
<?= $this->e($maintainer['name']) ?>
<?php if (1 === (int) $maintainer['showemail']): ?>
&lt;<a href="/account-mail.php?handle=<?= $this->noHtml($maintainer['handle']) ?>">
<?= $this->e(str_replace(["@", "."], [" at ", " dot "], $maintainer['email'])) ?>
</a>&gt;
<?php endif ?>
(<?= $this->e($maintainer['role']) ?>)
<?php if (!empty($maintainer['wishlist'])): ?>
[<a href="/wishlist.php/<?= $this->e($maintainer['handle']) ?>">wishlist</a>]
<?php endif ?>
[<a href="/user/<?= $this->e($maintainer['handle']) ?>">details</a>]<br>
<?php endforeach ?>
</td>
</tr>
<tr>
<th valign="top" style="background-color: #cccccc">License</th>
<td valign="top" style="background-color: #e8e8e8"><?= $license ?></td>
</tr>
<tr>
<th valign="top" style="background-color: #cccccc">Description</th>
<td valign="top" style="background-color: #e8e8e8"><?= $this->nl2br($this->e($package['description'])) ?></td>
</tr>
<?php if (!empty($package['homepage'])): ?>
<tr>
<th valign="top" style="background-color: #cccccc">Homepage</th>
<td valign="top" style="background-color: #e8e8e8">
<a href="<?= $this->e($package['homepage']) ?>">
<?= $this->e($package['homepage']) ?>
</a>
</td>
</tr>
<?php endif ?>
<?php if ($release): ?>
<tr>
<th valign="top" style="background-color: #cccccc">
Release notes<br>
Version <?= $this->e($version) ?><br>
(<?= $this->e($release['state']) ?>)
</th>
<td valign="top" style="background-color: #e8e8e8">
<?= $this->nl2br($this->noHtml($release['releasenotes'])) ?>
</td>
</tr>
<?php endif ?>
<?php if (!empty($authUser)): ?>
<tr>
<td style="background-color: #e8e8e8" colspan="2">
<div style="text-align:right">
<a href="/package-edit.php?id=<?= $this->noHtml($package['packageid']) ?>">
<img src="/img/edit.gif" alt="Edit package information">
</a>
<?php if ($authUser->isAdmin()): ?>
&nbsp;<a href="/package-delete.php?id=<?= $this->noHtml($package['packageid']) ?>">
<img src="/img/delete.gif" alt="Delete package"></a>
<?php endif ?>
&nbsp;[<a href="/admin/package-maintainers.php?pid=<?= $this->noHtml($package['packageid']) ?>">
Edit maintainers
</a>]
</div>
</td>
</tr>
<?php endif ?>
</table>
</td>
</tr>
</table>
<?php if ($windows && $version): ?>
<div>&nbsp;</div>
<table cellpadding="0" cellspacing="1" style="width: 90%; border: 0px;">
<tr>
<td style="background-color: #000000">
<table cellpadding="2" cellspacing="1" style="width: 100%; border: 0px;">
<tr style="background-color: #CCCCCC;">
<th colspan="2">DLL List</th>
</tr>
<?php if (0 === count($urls) || !$urls): ?>
<tr>
<td style="background-color: #e8e8e8" colspan="2">
<i>No DLL available</i>
</td>
</tr>
<?php else: ?>
<?php foreach ($urls as $desc => $set): ?>
<tr>
<th valign="top" style="background-color: #cccccc">PHP <?= $this->e($desc) ?></th>
<td valign="top" style="background-color: #e8e8e8">
<?php foreach ($set as $url): ?>
<a href="<?= $this->e($url) ?>">
<?= $this->e($this->makeNiceLinkNameFromZipName($url)) ?>
</a>
<br>
<?php endforeach ?>
</td>
</tr>
<?php endforeach ?>
<?php endif ?>
</table>
</td>
</tr>
</table>
<?php endif ?>
<br>
<table border="0" cellspacing="3" cellpadding="3" height="48" width="90%" align="center">
<tr>
<td align="center">[ <a href="/get/<?= $this->noHtml($package['name']) ?>">Latest Tarball</a> ]</td>
<td align="center">[
<?php if ($version): ?>
<a href="/package-changelog.php?package=<?= $this->noHtml($package['name']) ?>&amp;release=<?= $this->noHtml($version) ?>">
Changelog
</a>
<?php else: ?>
<a href="/package-changelog.php?package=<?= $this->noHtml($package['name']) ?>">
Changelog
</a>
<?php endif ?>
]</td>
<td align="center">
[ <a href="/package-stats.php?pid=<?= $this->noHtml($package['packageid']) ?>&amp;rid=&amp;cid=<?= $this->noHtml($package['categoryid']) ?>">
View Statistics
</a> ]
</td>
</tr>
<tr>
<td align="center">
<?php if (!empty($package['cvs_link'])): ?>
[ <a href="<?= $this->e($package['cvs_link']) ?>" target="_blank">Browse Source</a> ]
<?php else: ?>
&nbsp;
<?php endif ?>
</td>
<td align="center">
<?php if (!empty($package['bug_link'])): ?>
[ <a href="<?= $this->e($package['bug_link']) ?>">Package Bugs</a> ]
<?php else: ?>
[ <a href="https://bugs.php.net/search.php?cmd=display&status=Open&package_name[]=<?= $this->noHtml($package['name']) ?>">
Package Bugs
</a> ]
<?php endif ?>
</td>
<td align="center">
<?php if (!empty($package['doc_link'])): ?>
[ <a href="<?= $this->e($package['doc_link']) ?>">
View Documentation
</a> ]
<?php endif ?>
</td>
</tr>
<?php if (empty($package['bug_link'])): ?>
<tr>
<td align="center">
[ <a href="https://bugs.php.net/report.php?package=<?= $this->noHtml($package['name']) ?>">
Report new bug
</a> ]
</td>
</tr>
<?php endif ?>
</table>
<br>
<?php if (!$releaseId): ?>
<table cellpadding="0" cellspacing="1" style="width: 90%; border: 0px;">
<tr>
<td style="background-color: #000000">
<table cellpadding="2" cellspacing="1" style="width: 100%; border: 0px;">
<tr style="background-color: #CCCCCC;">
<th colspan="5">Available Releases</th>
</tr>
<?php if (0 === count($package['releases'])): ?>
<tr>
<td style="background-color: #e8e8e8" colspan="2">
<i>No releases for this package.</i>
</td>
</tr>
<?php else: ?>
<tr>
<th valign="top" style="background-color: #ffffff">Version</th>
<th valign="top" style="background-color: #ffffff">State</th>
<th valign="top" style="background-color: #ffffff">Release Date</th>
<th valign="top" style="background-color: #ffffff">Downloads</th>
<th valign="top" style="background-color: #ffffff">&nbsp;</th>
</tr>
<?php foreach ($package['releases'] as $releaseVersion => $r): ?>
<?php
if (empty($r['state'])) {
$r['state'] = 'devel';
}
$r['releasedate'] = substr($r['releasedate'], 0, 10);
$downloads_html = '';
foreach ($downloads[$releaseVersion] as $dl) {
$downloads_html .= "<a href=\"/get/$dl[basename]\">".
"$dl[basename]</a> (".sprintf("%.1fkB",@filesize($dl['fullpath'])/1024.0).")";
$urls = $packageDll->getDllDownloadUrls($package['name'], $releaseVersion, $package['releases'][$releaseVersion]['releasedate']);
if ($urls) {
$downloads_html .= "&nbsp;&nbsp;<a href=\"/package/$package[name]/$releaseVersion/windows\">"
. "<img src=\"/img/windows-icon.png\" />DLL</a>";
}
}
?>
<tr>
<th valign="top" style="background-color: #cccccc">
<a href="/package/<?= $this->noHtml($package['name'].'/'.$releaseVersion) ?>"><?= $this->noHtml($releaseVersion) ?></a>
</th>
<td valign="top" style="background-color: #e8e8e8"><?= $this->e($r['state']) ?></td>
<td valign="top" style="background-color: #e8e8e8"><?= $this->e($r['releasedate']) ?></td>
<td valign="top" style="background-color: #e8e8e8"><?= $downloads_html ?></td>
<td valign="top" style="background-color: #e8e8e8">
<small>
[
<a href="/package-changelog.php?package=<?= $this->noHtml($package['name']) ?>&release=<?= $this->noHtml($releaseVersion) ?>">
Changelog
</a>
]
</small>
</td>
</tr>
<?php endforeach ?>
<?php endif ?>
</table>
</td>
</tr>
</table>
<br><br>
<?php endif ?>
<table cellpadding="0" cellspacing="1" style="width: 90%; border: 0px;">
<tr>
<td style="background-color: #000000">
<table cellpadding="2" cellspacing="1" style="width: 100%; border: 0px;">
<tr style="background-color: #CCCCCC;">
<th colspan="2">Dependencies<?= $releaseId ? ' for release '.$version : '' ?></th>
</tr>
<?php if (empty($downloads) && !$releaseId): ?>
<tr>
<td style="background-color: #e8e8e8" colspan="2">
<i>No releases yet.</i>
</td>
</tr>
<?php else: ?>
<?php
$rels = $package['releases'];
// Check if there are too much things to show
if (count ($rels) > 3) {
$sliced = true;
$rels = array_slice($rels, 0, 3);
} else {
$sliced = false;
}
$rel_trans = [
'lt' => 'older than %s',
'le' => 'version %s or older',
'eq' => 'version %s',
'ne' => 'any version but %s',
'gt' => 'newer than %s',
'ge' => '%s or newer',
];
$dep_type_desc = [
'pkg' => 'PEAR Package',
'pkg_pecl' => 'PECL Package',
'ext' => 'PHP Extension',
'php' => 'PHP Version',
'prog' => 'Program',
'ldlib' => 'Development Library',
'rtlib' => 'Runtime Library',
'os' => 'Operating System',
'websrv' => 'Web Server',
'sapi' => 'SAPI Backend',
];
// Loop per version
foreach ($rels as $releaseVersion => $rel):
$dep_text = '';
if (!empty($version) && $releaseVersion != $version) {
continue;
}
$deps = isset($package['releases'][$releaseVersion]['deps']) ? $package['releases'][$releaseVersion]['deps'] : [];
?>
<?php if (count($deps) > 0): ?>
<?php foreach ($deps as $row): ?>
<?php
// TODO: We have PEAR installer deps both with the name of PEAR
// Installer and PEAR, make it consistent here until it is fixed
// in the db.
if ($row['name'] == 'PEAR Installer') {
$row['name'] = 'PEAR';
}
// TODO: Fix up wrong dep types here, until it is fixed in the
// db, we only have the pecl packages in the db now.
if ($row['type'] == 'pkg' && $this->findPackage($row['name'])) {
$row['type'] = 'pkg_pecl';
}
if ($row['type'] == 'pkg_pecl') {
$dep_name_html = sprintf('<a href="/package/%s">%s</a>', $row['name'], $row['name']);
} elseif ($row['type'] == 'pkg') {
$dep_name_html = sprintf('<a href="https://pear.php.net/package/%s">%s</a>', $row['name'], $row['name']);
} else {
$dep_name_html = $row['name'];
}
if (isset($rel_trans[$row['relation']])) {
$rel = sprintf($rel_trans[$row['relation']], $row['version']);
$dep_text .= sprintf("%s: %s %s",
$dep_type_desc[$row['type']], $dep_name_html, $rel);
} else {
$dep_text .= sprintf("%s: %s", $dep_type_desc[$row['type']], $dep_name_html);
}
$dep_text .= "<br />";
?>
<?php endforeach ?>
<tr>
<th valign="top" style="background-color: #cccccc"><?= empty($version) ? $this->e('Release '.$releaseVersion.':') : '' ?></th>
<td valign="top" style="background-color: #e8e8e8"><?= $dep_text ?></td>
</tr>
<?php else: ?>
<tr>
<th valign="top" style="background-color: #cccccc"><?= empty($version) ? $this->e('Release '.$releaseVersion.':') : '' ?></th>
<td valign="top" style="background-color: #e8e8e8">No dependencies registered.</td>
</tr>
<?php endif ?>
<?php endforeach ?>
<?php if ($sliced && '' === $version): ?>
<tr>
<td style="background-color: #e8e8e8" colspan="2">
Dependencies for older releases can be found on the release overview page.
</td>
</tr>
<?php endif ?>
<?php endif ?>
</table>
</td>
</tr>
</table>
<?php if (count($dependants) > 0): ?>
<br><br>
<table cellpadding="0" cellspacing="1" style="width: 90%; border: 0px;">
<tr>
<td style="background-color: #000000">
<table cellpadding="2" cellspacing="1" style="width: 100%; border: 0px;">
<tr style="background-color: #CCCCCC;">
<th>Packages that depend on <?= $this->e($package['name']) ?></th>
</tr>
<?php foreach ($dependants as $dep): ?>
<tr>
<td valign="top" style="background-color: #ffffff">
<a href="/package/<?= $this->noHtml($dep['p_name']) ?>">
<?= $this->noHtml($dep['p_name']) ?>
</a>
</td>
</tr>
<?php endforeach ?>
</table>
</td>
</tr>
</table>
<?php endif ?>
<?php $this->end('content') ?>