]>
git.wh0rd.org - tt-rss.git/blob - stats.php
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";
10 $link = db_connect(DB_HOST
, DB_USER
, DB_PASS
, DB_NAME
);
12 login_sequence($link);
14 if ($_SESSION["access_level"] < 10) {
15 header("Location: error.php?c=8");
22 <title
>Tiny Tiny Statistics
</title
>
27 <h1
>Tiny Tiny Statistics
</h1
>
32 $result = db_query($link, "SELECT count(id) AS cid,
33 SUM(LENGTH(content)) AS size
36 $total_articles = db_fetch_result($result, 0, "cid");
37 $articles_size = round(db_fetch_result($result, 0, "size") / 1024);
39 print "<p>Total articles stored: $total_articles (${articles_size}K)</p>";
41 $result = db_query($link, "SELECT COUNT(int_id) as cid,owner_uid,login
42 FROM ttrss_user_entries
43 JOIN ttrss_users ON (owner_uid = ttrss_users.id)
44 GROUP BY owner_uid,login ORDER BY cid DESC");
46 print "<h2>Per-user storage</h2>";
48 print "<table width='100%'>";
55 while ($line = db_fetch_assoc($result)) {
57 print "<td>" . $line["cid"] . "</td><td>" . $line["login"] . "</td>";
63 print "<h2>User subscriptions</h2>";
65 $result = db_query($link, "SELECT title,feed_url,site_url,login,
66 (SELECT count(int_id) FROM ttrss_user_entries
67 WHERE feed_id = ttrss_feeds.id) AS num_articles,
68 (SELECT count(int_id) FROM ttrss_user_entries
69 WHERE feed_id = ttrss_feeds.id AND unread = true) AS num_articles_unread
70 FROM ttrss_feeds,ttrss_users
71 WHERE owner_uid = ttrss_users.id ORDER BY login");
73 print "<table width='100%'>";
78 <td>Stored Articles</td>
79 <td>Unread Articles</td>
84 while ($line = db_fetch_assoc($result)) {
86 print "<td><a href=\"".$line["site_url"]."\">".$line["title"]."</a></td>";
87 print "<td><a href=\"".$line["feed_url"]."\">".$line["feed_url"]."</a></td>";
88 print "<td>" . $line["login"] . "</td>";
89 print "<td>" . $line["num_articles"] . "</td>";
90 print "<td>" . $line["num_articles_unread"] . "</td>";
93 if ($cur_login != $line["login"] && $cur_login != "") {
94 print "<tr><td> </td></tr>";
95 $cur_login = $line["login"];