forked from ABXD-4-0/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostradar.pap
executable file
·62 lines (55 loc) · 1.66 KB
/
postradar.pap
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
<?php
/* Post Radar
* By Kawa
*
* External requirements:
* the other postradar.php in root.
*
* Based on old ABXD 1.3.1 post radar by Nikolaj.
*/
registerPlugin("Post radar");
function PostRadar_Write($tag = "")
{
global $loguserid, $loguser, $dbpref;
if($tag != "userBar" || $loguserid == 0)
return;
// TODO: Change it so it will not require query ($dblink->list_tables() IS query)
Query("CREATE TABLE IF NOT EXISTS `{postradar}` (`user` int(11) NOT NULL, `userid` int(11) NOT NULL);");
$qEntries = "SELECT id, name, displayname, sex, powerlevel, posts FROM {postradar} LEFT JOIN {users} ON {postradar}.user = {users}.id WHERE userid=".$loguserid." order by posts DESC";
$rEntries = Query($qEntries);
if(NumRows($rEntries))
{
$radar = "<ul class=\"pipemenu\">\r\n";
while ($user = Fetch($rEntries))
{
$delta = "";
if ($user['posts'] == $loguser['posts'])
{
$radar .= "<li>".UserLink($user)." (0)</li>\r\n";
}
else if ($user['posts'] > $loguser['posts'])
{
$radar .= format("<li>{0} ({1} behind)</li>\r\n", UserLink($user), $user['posts'] - $loguser['posts']);
}
else if ($user['posts'] < $loguser['posts'])
{
$radar .= format("<li>{0} ({1} ahead)</li>\r\n", UserLink($user), $loguser['posts'] - $user['posts']);
}
}
Write(
"
<div class=\"header1 cell1\" style=\"border-top: 0px; text-align: center\">
<a href=\"postradar.php\" style=\"float: right;\">Edit</a>
Post Radar: {0}
</div>
", $radar);
}
}
function PostRadar_Header($tag)
{
if($tag == "bottom")
Write("<li><a href=\"postradar.php\">Post radar</a></li>");
}
register("writers", "PostRadar_Write",1);
register("headers", "PostRadar_Header", 1);
?>