| 1 |
<?php |
|---|
| 2 |
require_once "sessions.php"; |
|---|
| 3 |
|
|---|
| 4 |
require_once "sanity_check.php"; |
|---|
| 5 |
require_once "version.php"; |
|---|
| 6 |
require_once "config.php"; |
|---|
| 7 |
require_once "db-prefs.php"; |
|---|
| 8 |
require_once "functions.php"; |
|---|
| 9 |
|
|---|
| 10 |
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); |
|---|
| 11 |
|
|---|
| 12 |
login_sequence($link); |
|---|
| 13 |
|
|---|
| 14 |
if ($_SESSION["access_level"] < 10) { |
|---|
| 15 |
print "<p>Error: your access level is insufficient to run this script.</p>"; |
|---|
| 16 |
exit; |
|---|
| 17 |
} |
|---|
| 18 |
?> |
|---|
| 19 |
|
|---|
| 20 |
<html> |
|---|
| 21 |
<head> |
|---|
| 22 |
<title>Tiny Tiny Statistics</title> |
|---|
| 23 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 24 |
</head> |
|---|
| 25 |
|
|---|
| 26 |
<body> |
|---|
| 27 |
|
|---|
| 28 |
<h1>Tiny Tiny Statistics</h1> |
|---|
| 29 |
|
|---|
| 30 |
<h2>Counters</h2> |
|---|
| 31 |
|
|---|
| 32 |
<?php |
|---|
| 33 |
$result = db_query($link, "SELECT count(id) AS cid, |
|---|
| 34 |
SUM(LENGTH(content)) AS size |
|---|
| 35 |
FROM ttrss_entries"); |
|---|
| 36 |
|
|---|
| 37 |
$total_articles = db_fetch_result($result, 0, "cid"); |
|---|
| 38 |
$articles_size = round(db_fetch_result($result, 0, "size") / 1024); |
|---|
| 39 |
|
|---|
| 40 |
print "<p>Total articles stored: $total_articles (${articles_size}K)</p>"; |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
$result = db_query($link, "SELECT count(ttrss_entries.id) AS cid, |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
); |
|---|
| 52 |
|
|---|
| 53 |
"<h2>Per-user storage</h2>"; |
|---|
| 54 |
|
|---|
| 55 |
"<table border width='100%'>"; |
|---|
| 56 |
|
|---|
| 57 |
"<tr> |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
; |
|---|
| 61 |
|
|---|
| 62 |
$line = db_fetch_assoc($result)) { |
|---|
| 63 |
"<tr>"; |
|---|
| 64 |
"<td>" . $line["cid"] . "</td>"; |
|---|
| 65 |
"<td>" . $line["login"] . "</td>"; |
|---|
| 66 |
"</tr>"; |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
"</table>"; |
|---|
| 70 |
|
|---|
| 71 |
$result = db_query($link, "SELECT COUNT(ttrss_feeds.id) AS fc, |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
); |
|---|
| 75 |
|
|---|
| 76 |
"<h2>Per-user subscriptions</h2>"; |
|---|
| 77 |
|
|---|
| 78 |
"<table border width='100%'>"; |
|---|
| 79 |
|
|---|
| 80 |
"<tr> |
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
; |
|---|
| 84 |
|
|---|
| 85 |
$line = db_fetch_assoc($result)) { |
|---|
| 86 |
"<tr>"; |
|---|
| 87 |
"<td>" . $line["login"] . "</td>"; |
|---|
| 88 |
"<td>" . $line["fc"] . "</td>"; |
|---|
| 89 |
"</tr>"; |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
"</table>"; |
|---|
| 93 |
|
|---|
| 94 |
"<h2>User subscriptions</h2>"; |
|---|
| 95 |
|
|---|
| 96 |
$result = db_query($link, "SELECT title,feed_url,site_url,login, |
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
); |
|---|
| 103 |
|
|---|
| 104 |
"<table border width='100%'>"; |
|---|
| 105 |
"<tr> |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
; |
|---|
| 112 |
|
|---|
| 113 |
$cur_login = ""; |
|---|
| 114 |
|
|---|
| 115 |
$line = db_fetch_assoc($result)) { |
|---|
| 116 |
"<tr>"; |
|---|
| 117 |
"<td><a href=\"".$line["site_url"]."\">".$line["title"]."</a></td>"; |
|---|
| 118 |
"<td><a href=\"".$line["feed_url"]."\">".$line["feed_url"]."</a></td>"; |
|---|
| 119 |
"<td>" . $line["login"] . "</td>"; |
|---|
| 120 |
"<td>" . $line["num_articles"] . "</td>"; |
|---|
| 121 |
"<td>" . $line["num_articles_unread"] . "</td>"; |
|---|
| 122 |
"</tr>"; |
|---|
| 123 |
|
|---|
| 124 |
$cur_login != $line["login"] && $cur_login != "") { |
|---|
| 125 |
"<tr><td> </td></tr>"; |
|---|
| 126 |
$cur_login = $line["login"]; |
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
"</table>"; |
|---|
| 131 |
|
|---|
| 132 |
?> |
|---|
| 133 |
</pre> |
|---|
| 134 |
|
|---|
| 135 |
</body> |
|---|
| 136 |
</html> |
|---|
| 137 |
|
|---|