forked from pouetnet/pouet2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprod_nfo.php
94 lines (82 loc) · 2.64 KB
/
prod_nfo.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?
require_once("bootstrap.inc.php");
class PouetBoxProdNfo extends PouetBox {
function PouetBoxProdNfo() {
parent::__construct();
$this->uniqueID = "pouetbox_prodnfo";
$this->title = "prod nfo";
}
function LoadFromDB()
{
$this->prod = PouetProd::spawn( $_GET["which"] );
$s = new BM_Query();
$s->AddField("added");
$s->AddTable("nfos");
$s->SetLimit(1);
$s->attach(array("nfos"=>"user"),array("users as user"=>"id"));
$s->AddWhere(sprintf_esc("prod=%d",$this->prod->id));
list($this->nfo) = $s->perform();
}
function RenderHeader()
{
echo "\n\n";
echo "<div class='pouettbl asciiviewer' id='".$this->uniqueID."'>\n";
echo " <h2><big>".$this->prod->RenderLink()."</big>";
if ($this->prod->groups)
echo " by ".$this->prod->RenderGroupsLong();
echo "</h2>\n";
}
function RenderBody()
{
$title = "nfo added by "._html($this->nfo->user->nickname)." on "._html($this->nfo->added);
echo "<div class='content' title='".$title."'>\n";
if ($_GET["font"]=="none")
{
echo "<pre>";
$text = file_get_contents( get_local_nfo_path( $_GET["which"] ) );
echo _html( process_ascii( $text ) );
echo "</pre>";
}
else
printf("<img src='img_ascii.php?nfo=%d&font=%d' alt='nfo'/>\n",$_GET["which"],$_GET["font"]);
echo "</div>\n";
}
function RenderFooter()
{
global $currentUser;
echo " <div class='content' id='fontlist'>";
$fonts = array(
"none" => "html",
"1" => "dos 80*25",
"2" => "dos 80*50",
"3" => "rez's ascii",
"4" => "amiga medres",
"5" => "amiga hires",
);
foreach($fonts as $k=>$v)
$a[] = sprintf("<a href='prod_nfo.php?which=%d&font=%s'>%s</a>\n",$_GET["which"],$k,$v);
echo "[ ".implode(" | \n",$a)." ]";
echo " </div>";
echo " <div class='foot'>";
if ($currentUser && $currentUser->IsGloperator())
{
printf("[ <a class='adminlink' href='admin_prod_edit.php?which=%d#files'>update nfo</a> ]\n",$_GET["which"]);
printf("[ <a class='adminlink' href='%s'>download nfo</a> ]\n",get_nfo_url( $_GET["which"] ));
}
printf("[ <a href='prod.php?which=%d'>back to the prod</a> ]\n",$_GET["which"]);
echo " </div>";
echo "</div>";
}
};
$box = new PouetBoxProdNfo();
$box->Load();
if ($box->prod)
$TITLE = $box->prod->name.($box->prod->groups ? " by ".$box->prod->RenderGroupsPlain() : "")." :: nfo";
require_once("include_pouet/header.php");
require("include_pouet/menu.inc.php");
echo "<div id='content'>\n";
$box->Render();
echo "</div>\n";
require("include_pouet/menu.inc.php");
require_once("include_pouet/footer.php");
?>