| CODENOTIFIER | HelpYou are not signed inSign in |
Project: ejabberd-modules
Revision: 705
Author: kolargol
Date: 06 Aug 2008 11:02:27
Changes:Diff:| ... | ...@@ -2,7 +2,7 @@ | |
| 2 | 2 | /* |
| 3 | 3 | Jorge - frontend for mod_logdb - ejabberd server-side message archive module. |
| 4 | 4 | |
| 5 | Copyright (C) 2007 Zbigniew Zolkiewski | |
| 5 | Copyright (C) 2008 Zbigniew Zolkiewski | |
| 6 | 6 | |
| 7 | 7 | This program is free software; you can redistribute it and/or |
| 8 | 8 | modify it under the terms of the GNU General Public License |
| ... | ...@@ -22,7 +22,12 @@ | |
| 22 | 22 | require_once("headers.php"); |
| 23 | 23 | require_once("upper.php"); |
| 24 | 24 | |
| 25 | if (ADMIN_NAME!==TOKEN) { print 'no access'; exit; } | |
| 25 | if (ADMIN_NAME!==TOKEN) { | |
| 26 | ||
| 27 | print 'no access'; | |
| 28 | exit; | |
| 29 | ||
| 30 | } | |
| 26 | 31 | |
| 27 | 32 | // get dates |
| 28 | 33 | $today = date("Y-n-j"); |
| ... | ...@@ -68,94 +73,104 @@ | |
| 68 | 73 | mysql_free_result(); |
| 69 | 74 | |
| 70 | 75 | |
| 71 | print "<h2><u>Stats for: ".$xmpp_host_dotted."</u></h2>"; | |
| 72 | print "<p style=\"padding-left: 10px;\">Total <b>".number_format(total_messages($xmpp_host))."</b> messages logged by the server in <b>".number_format(total_chats($xmpp_host))."</b> conversations. Current database size is: <b>".db_size()."</b> MB</p>"; | |
| 73 | print '<hr size="1" noshade="" color="#cccccc"/>'."\n"; | |
| 74 | print '<table class="ff">'."\n"; | |
| 75 | print '<tr><td style="padding-left: 10px">'."\n"; | |
| 76 | if ($mark1=="1") { print '<h1>Not enough data collected for graphs</h1><h2>minimum required: 30 days</h2>';} | |
| 77 | print '<div id="no_users" style="width:1000px;height:250px;"></div>'."\n"; | |
| 78 | print "<br>"; | |
| 79 | print '<div id="no_messages" style="width:1000px;height:250px;"></div>'."\n"; | |
| 80 | print "<br>"; | |
| 81 | print '<div id="hourly_yesterday" style="width:1000px;height:250px;"></div>'."\n"; | |
| 82 | print "<br>"; | |
| 83 | print '<div id="hourly_week" style="width:1000px;height:250px;"></div>'."\n"; | |
| 84 | print '</td>'; | |
| 85 | print '<td style="padding-left: 30px; vertical-align: top;">'."\n"; | |
| 86 | print '<div><b>Top 10 talkers today:</b><br><br>'."\n"; | |
| 76 | $html->set_body('<h2><u>Stats for: '.$xmpp_host_dotted.'</u></h2><p style="padding-left: 10px;"> | |
| 77 | Total <b>'.number_format(total_messages($xmpp_host)).'</b> messages logged by the server in <b>'.number_format(total_chats($xmpp_host)).'</b> conversations. Current database size is: <b>'.db_size().'</b> MB</p> | |
| 78 | <hr size="1" noshade="" color="#cccccc"/><table class="ff"> | |
| 79 | <tr><td style="padding-left: 10px"><div id="no_users" style="width:1000px;height:250px;"></div><br> | |
| 80 | <div id="no_messages" style="width:1000px;height:250px;"></div><br> | |
| 81 | <div id="hourly_yesterday" style="width:1000px;height:250px;"></div><br> | |
| 82 | <div id="hourly_week" style="width:1000px;height:250px;"></div></td> | |
| 83 | <td style="padding-left: 30px; vertical-align: top;"> | |
| 84 | <div><b>Top 10 talkers today:</b><br><br> | |
| 85 | '); | |
| 86 | ||
| 87 | if ($mark1=="1") { | |
| 88 | ||
| 89 | $html->render_alert('Not enough data collected for graphs</h1><h2>minimum required: 30 days'); | |
| 90 | ||
| 91 | } | |
| 92 | ||
| 93 | ||
| 87 | 94 | $result=mysql_query($top_ten_talkers_today); |
| 88 | 95 | $i=0; |
| 89 | 96 | while ($entry=mysql_fetch_array($result)) { |
| 90 | 97 | |
| 91 | 98 | $i++; |
| 92 | print "<b>".$i.".</b> ".htmlspecialchars(get_user_name($entry[owner_id],$xmpp_host))."@".$xmpp_host_dotted."<b> --> </b>".htmlspecialchars(get_user_name($entry[peer_name_id],$xmpp_host))."@".htmlspecialchars(get_server_name($entry[peer_server_id],$xmpp_host))." (<i><b>$entry[count]</b></i>)<br>"."\n"; | |
| 99 | $html->set_body('<b>'.$i.'.</b> '.htmlspecialchars(get_user_name($entry[owner_id],$xmpp_host)).'@'.$xmpp_host_dotted.'<b> --> </b>'.htmlspecialchars(get_user_name($entry[peer_name_id],$xmpp_host)).'@'.htmlspecialchars(get_server_name($entry[peer_server_id],$xmpp_host)).' (<i><b>'.$entry[count].'</b></i>)<br>'); | |
| 93 | 100 | |
| 94 | 101 | } |
| 95 | print '</div>'."\n"; | |
| 96 | print '<br><hr size="1" noshade="" color="#cccccc"/><br>'."\n"; | |
| 102 | $html->set_body('</div><br><hr size="1" noshade="" color="#cccccc"/><br>'); | |
| 103 | ||
| 97 | 104 | $i=0; |
| 98 | print '<div><b>Top 10 talkers yesterday:</b><br><br>'."\n"; | |
| 105 | $html->set_body('<div><b>Top 10 talkers yesterday:</b><br><br>'); | |
| 106 | ||
| 99 | 107 | $result=mysql_query($top_ten_talkers_yesterday); |
| 100 | 108 | while ($entry=mysql_fetch_array($result)) { |
| 101 | 109 | |
| 102 | 110 | $i++; |
| 103 | print "<b>".$i.".</b> ".htmlspecialchars(get_user_name($entry[owner_id],$xmpp_host))."@".$xmpp_host_dotted."<b> --> </b>".htmlspecialchars(get_user_name($entry[peer_name_id],$xmpp_host))."@".htmlspecialchars(get_server_name($entry[peer_server_id],$xmpp_host))." (<i><b>$entry[count]</b></i>)<br>"."\n"; | |
| 111 | $html->set_body('<b>'.$i.'.</b> '.htmlspecialchars(get_user_name($entry[owner_id],$xmpp_host)).'@'.$xmpp_host_dotted.'<b> --> </b>'.htmlspecialchars(get_user_name($entry[peer_name_id],$xmpp_host)).'@'.htmlspecialchars(get_server_name($entry[peer_server_id],$xmpp_host)).' (<i><b>'.$entry[count].'</b></i>)<br>'); | |
| 104 | 112 | |
| 105 | 113 | } |
| 106 | 114 | |
| 107 | print '</td>'."\n"; | |
| 108 | print '</tr></table>'."\n"; | |
| 115 | $html->set_body('</td></tr></table>'); | |
| 109 | 116 | |
| 110 | 117 | if ($mark1=="0") { |
| 111 | 118 | |
| 112 | ?> | |
| 119 | $html->set_body(' | |
| 113 | 120 | |
| 114 | 121 | <script id="source" language="javascript" type="text/javascript"> |
| 115 | 122 | $(function () { |
| 116 | 123 | |
| 117 | 124 | var d1 = [ |
| 118 | <? | |
| 125 | ||
| 126 | '); | |
| 127 | ||
| 119 | 128 | $cn=31; |
| 120 | 129 | for ($z=1;$z<31;$z++) { |
| 121 | 130 | $cn--; |
| 122 | print "[$f[$cn],$e[$cn]],"; | |
| 131 | $html->set_body("[$f[$cn],$e[$cn]],"); | |
| 123 | 132 | } |
| 124 | ?> | |
| 133 | ||
| 134 | $html->set_body(' | |
| 125 | 135 | |
| 126 | 136 | |
| 127 | 137 | ]; |
| 128 | 138 | |
| 129 | 139 | var d2 = [ |
| 130 | 140 | |
| 131 | <? | |
| 141 | '); | |
| 132 | 142 | $cn=31; |
| 133 | 143 | for ($z=1; $z<31; $z++) { |
| 134 | 144 | $cn--; |
| 135 | print "[$f[$cn],$d[$cn]],"; | |
| 145 | $html->set_body("[$f[$cn],$d[$cn]],"); | |
| 136 | 146 | } |
| 137 | ?> | |
| 147 | ||
| 148 | $html->set_body(' | |
| 138 | 149 | |
| 139 | 150 | |
| 140 | 151 | ]; |
| 141 | 152 | |
| 142 | 153 | var d3 = [ |
| 143 | <? | |
| 154 | ||
| 155 | '); | |
| 144 | 156 | for ($z=0;$z<24;$z++) { |
| 145 | print "[$z,$hs[$z]],"; | |
| 157 | $html->set_body("[$z,$hs[$z]],"); | |
| 146 | 158 | } |
| 147 | ?> | |
| 159 | ||
| 160 | $html->set_body(' | |
| 148 | 161 | |
| 149 | 162 | ]; |
| 150 | 163 | |
| 151 | 164 | var d4 = [ |
| 152 | <? | |
| 165 | '); | |
| 166 | ||
| 153 | 167 | $idx=0; |
| 154 | 168 | for ($z=0;$z<168;$z++) { |
| 155 | 169 | $idx++; |
| 156 | print "[$z,$hy[$idx]],"; | |
| 170 | $html->set_body("[$z,$hy[$idx]],"); | |
| 157 | 171 | } |
| 158 | ?> | |
| 172 | ||
| 173 | $html->set_body(' | |
| 159 | 174 | |
| 160 | 175 | ]; |
| 161 | 176 | |
| ... | ...@@ -182,7 +197,7 @@ | |
| 182 | 197 | |
| 183 | 198 | { |
| 184 | 199 | color: "#ff0000", |
| 185 | label: "Hourly Statistics - Yesterday (<? print $yesterday; ?>)", shadowSize: 10, data: d3, | |
| 200 | label: "Hourly Statistics - Yesterday ('.$yesterday.')", shadowSize: 10, data: d3, | |
| 186 | 201 | bars: { show: true } |
| 187 | 202 | } |
| 188 | 203 | |
| ... | ...@@ -193,7 +208,7 @@ | |
| 193 | 208 | |
| 194 | 209 | { |
| 195 | 210 | color: "#3480ff", |
| 196 | label: "Hourly Statistics - Weekly Raport (<? print $last_week." - ".$yesterday; ?>)", shadowSize: 10, data: d4, | |
| 211 | label: "Hourly Statistics - Weekly Raport ('.$last_week.' - '.$yesterday.')", shadowSize: 10, data: d4, | |
| 197 | 212 | bars: { show: true } |
| 198 | 213 | } |
| 199 | 214 | ]); |
| ... | ...@@ -202,8 +217,7 @@ | |
| 202 | 217 | |
| 203 | 218 | </script> |
| 204 | 219 | |
| 205 | ||
| 206 | <? | |
| 220 | '); | |
| 207 | 221 | |
| 208 | 222 | } |
| 209 | 223 |