-
Notifications
You must be signed in to change notification settings - Fork 2
/
Show.php
61 lines (53 loc) · 1.43 KB
/
Show.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
session_start();
if (!isset($_GET['RepositoryId']))
{
http_response_code(400);
return;
}
require_once 'Globals.php';
require_once 'Models/Plugin.php';
require_once 'Environment Interfaces/Session.php';
$Query = DB::queryFirstRow(
'SELECT * FROM Authors, PluginData WHERE Authors.AuthorId = PluginData.AuthorId AND RepositoryId = %i',
$_GET['RepositoryId']
);
if ($Query === null)
{
http_response_code(404);
return;
}
$Templater = new \Twig\Environment(GetTwigLoader(), GetTwigOptions());
$Downloads = DB::query('SELECT Name, Tag, Hyperlink FROM DownloadHyperlinks WHERE RepositoryId = %i', $_GET['RepositoryId']);
$Screenshots = DB::query('SELECT Name, Hyperlink FROM ScreenshotHyperlinks WHERE RepositoryId = %i', $_GET['RepositoryId']);
$Comments = DB::query(
'SELECT Comment, CreationTime, Login, DisplayName, AvatarHyperlink
FROM Authors, Comments WHERE Authors.AuthorId = Comments.AuthorId AND RepositoryId = %i', $_GET['RepositoryId']
);
$Templater->addFilter(
new \Twig\TwigFilter(
'parsedown',
function($Markdown)
{
if ($Markdown === null)
{
return null;
}
$Parser = new \Parsedown();
$Parser->setSafeMode(true);
return $Parser->text($Markdown);
}
)
);
$Details = Session::GetLoggedInDetails();
$Templater->display(
'Expanded Plugin.html',
array(
'Plugin' => $Query,
'Downloads' => $Downloads,
'Screenshots' => $Screenshots,
'Comments' => $Comments,
'LoginDetails' => $Details
)
);
?>