-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopwiki.php
More file actions
executable file
·74 lines (60 loc) · 1.59 KB
/
Copy pathtopwiki.php
File metadata and controls
executable file
·74 lines (60 loc) · 1.59 KB
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
<?php
//
// Wiki module to show topten for QuantumSTEP
//
// used as $(module topwiki topten 10)
//
//
// FIXME:
// - allow for count=10
//
function module_topten($argv)
{
global $_SERVER, $DATABASE, $USER, $HOST, $PASSWORD;
$hours=24;
$count=($argv[3]+0);
if(!$count)
$count=10;
if($_SERVER['SERVER_NAME'] == "localhost")
{
$DB_TABLE="swi";
$DB_DATABASE="killefiz"; // on localhost
$DB_USER=$USER;
}
else
{
$DB_TABLE="swi_qs";
$DB_DATABASE="quantumstep"; // on server
$DB_USER="root";
}
// echo "swi=$DB_DATABASE<br>";
// echo "wiki=$DATABASE<br>";
mysql_close();
@mysql_pconnect($HOST, $DB_USER, $PASSWORD);
if(mysql_error())
echo "Could not reconnect to $HOST<br>";
if(!mysql_select_db($DB_DATABASE))
echo "Could not select $DB_DATABASE on $HOST<br>";
query("delete from ${DB_TABLE}_visitors where `when` < date_sub(now(), interval $hours hour)"); // remove older entries
$query="select id, name, summary, appid, count(appid)/$hours as upd from ${DB_TABLE}_visitors, ${DB_TABLE}";
$query.=" where approved=1";
$query.=" and id=appid";
$query.=" group by appid";
$query.=" order by upd desc, ${DB_TABLE}.name asc";
$query.=" limit $count";
$result=query($query);
$r="<font size=-1>";
while($row=mysql_fetch_array($result))
{
$r.="<a href=\"swi/showdetail.php?appname=".rawurlencode($row['name'])."\">".
htmlentities($row['name']).
"</a> (".$row['upd'].")<br>";
}
mysql_free_result($result);
mysql_close();
@mysql_pconnect($HOST, $USER, $PASSWORD);
mysql_select_db($DATABASE); // back to wiki database
$r.="</font>";
return output($r, $record);
}
?>