<?php
/**
* type: page
* title: Project detail view
* description: List project entry with all URLs and releases
* license: AGPL
* version 0.6
*
* Shows:
* → General project description
* → Sidebar with project links, submitter, management links, social share count
* → Release history and changelogs
* Adds:
* → RSS/Atom links to header template
*
*/
// Current project id
$name = $_REQUEST->proj_name["name"];
// Redirect to new name?
if (isset($renamed_proj[$name])) {
exit(header("Location: /projects/{$renamed_proj[$name]}", 303));
}
#-- Fetch project/release entries
$releases = db("
SELECT *, MAX(t_changed)
FROM release
WHERE name = ?
AND flag < 5
AND NOT deleted
GROUP BY version
ORDER BY t_published DESC, t_changed DESC
", $name);
// Retrieve most current project version
if ($entry = $releases->fetch()) {
prepare_output($entry);
// prepare HTML header with injected RSS/Atom links
$h = "htmlspecialchars";
$header_add = <<<HTML
<link rel=alternate type=application/rss+xml href="/feed/$name.rss">
<link rel=alternate type=application/atom+xml href="/feed/$name.atom">
<link rel=alternate type=json/vnd.freshcode.club href="/feed/$name.json">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@versiontracker">
<meta name="twitter:creator" content="@versiontracker">
<meta name="twitter:title" content="{$h($entry['title'])} ({$h($entry['version'])})">
<meta name="twitter:description" content="{$h($entry['description'])}">
<meta name="twitter:image" content="https://freshcode.club{$h($entry['image'])}">
<meta name="twitter:image:src" content="https://freshcode.club{$h($entry['image'])}">
HTML;
$title = input::html($entry["title"]) . " - freshcode.club";
include("template/header.php");
// Show sidebar + long project description
$sb_entry = $entry;
include("template/table_main.php");
include("template/projects_description.php");
#-- Display all other released versions
?> <article class=release-list> <h4>Recent Releases</h4> <?php
do {
include("template/projects_release_entry.php");
}
while ($entry = $releases->fetch() and prepare_output($entry) + 1);
?> </article> <?php
// html tail
$entry = $sb_entry;
include("template/projects_sidebar.php");
include("template/table_end.php");
include("template/bottom.php");
}
// No entry found
else {
exit($error = "Project name doesn't exist." and include("page_error.php"));
}
?>