-
Notifications
You must be signed in to change notification settings - Fork 28
/
oneliner.php
99 lines (84 loc) · 2.63 KB
/
oneliner.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
95
96
97
98
99
<?php
require_once("bootstrap.inc.php");
require_once("include_pouet/box-bbs-post.php");
$POSTS_PER_PAGE = 25;
class PouetBoxOnelinerView extends PouetBox
{
public $postcount;
public $paginator;
public $oneliner;
function __construct()
{
parent::__construct();
$this->uniqueID = "pouetbox_onelinerview";
$this->title = "the so complete pouët.net oneliner";
}
function LoadFromDB() {
global $POSTS_PER_PAGE;
$s = new SQLSelect();
$s->AddField("count(*) as c");
$s->AddTable("oneliner");
if (@$_GET["who"])
$s->AddWhere(sprintf_esc("oneliner.who = %d",$_GET["who"]));
$this->postcount = SQLLib::SelectRow($s->GetQuery())->c;
$s = new BM_Query();
$s->AddTable("oneliner");
$s->AddField("oneliner.message");
$s->AddField("oneliner.addedDate");
$s->attach(array("oneliner"=>"who"),array("users as user"=>"id"));
if (@$_GET["who"])
$s->AddWhere(sprintf_esc("oneliner.who = %d",$_GET["who"]));
//$s->SetLimit( $POSTS_PER_PAGE, (int)(($this->page - 1)*$POSTS_PER_PAGE) );
$this->paginator = new PouetPaginator();
$this->paginator->SetData( (@$_GET["who"] ? "oneliner.php?who=".(int)$_GET["who"] : "oneliner.php"), $this->postcount, $POSTS_PER_PAGE, @$_GET["page"] );
$this->paginator->SetLimitOnQuery( $s );
$this->oneliner = $s->perform();
}
function RenderBody()
{
global $POSTS_PER_PAGE;
echo "<ul class='boxlist'>";
$lastDate = "";
foreach ($this->oneliner as $c)
{
$day = substr($c->addedDate,0,10);
if ($day != $lastDate)
{
echo "<li class='day'>".$day."</li>\n";
$lastDate = $day;
}
$p = $c->message;
$p = _html($p);
//$p = bbencode($p,true);
$p = preg_replace("/([a-z]+:\/\/\S+)/","<a href='$1' rel='external'>$1</a>",$p);
$p = nl2br($p);
$p = better_wordwrap($p,80," ");
echo "<li>";
echo "<time datetime='".$c->addedDate."' title='".$c->addedDate."'>".date("H:i",strtotime($c->addedDate))."</time> ";
echo $c->user->PrintLinkedAvatar()." ".$p;
echo "</li>\n";
}
echo "</ul>";
$this->paginator->RenderNavbar();
?>
<script>
document.observe("dom:loaded",function(){ StubLinksToDomainName($("pouetbox_onelinerview")); });
</script>
<?php
}
function RenderFooter()
{
echo "</div>\n";
}
};
$p = new PouetBoxOnelinerView();
$p->Load();
$TITLE = "oneliner";
require_once("include_pouet/header.php");
require("include_pouet/menu.inc.php");
echo "<div id='content'>\n";
echo $p->Render();
echo "</div>\n";
require("include_pouet/menu.inc.php");
require_once("include_pouet/footer.php");
?>