Changeset 726
- Timestamp:
- 09/09/05 02:36:34 (8 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 12 added
- 4 removed
- 8 modified
-
ChangeLog (modified) (1 diff)
-
wifidog/admin/graph_common.inc.php (added)
-
wifidog/admin/graph_per_hour.php (added)
-
wifidog/admin/graph_per_month.php (added)
-
wifidog/admin/graph_per_weekday.php (added)
-
wifidog/admin/graph_registrations.php (added)
-
wifidog/admin/graph_registrations_cumulative.php (added)
-
wifidog/admin/hotspot_log.php (deleted)
-
wifidog/admin/online_users.php (modified) (1 diff)
-
wifidog/admin/stats.php (added)
-
wifidog/admin/stats_all_networks.inc.php (added)
-
wifidog/admin/stats_network.inc.php (added)
-
wifidog/admin/stats_node.inc.php (added)
-
wifidog/admin/stats_user_id.inc.php (added)
-
wifidog/admin/stats_user_mac.inc.php (added)
-
wifidog/admin/templates/hotspot_log.html (deleted)
-
wifidog/admin/templates/online_users.html (modified) (2 diffs)
-
wifidog/admin/templates/user_stats.html (deleted)
-
wifidog/admin/user_stats.php (deleted)
-
wifidog/classes/MainUI.php (modified) (1 diff)
-
wifidog/classes/Network.php (modified) (2 diffs)
-
wifidog/classes/Node.php (modified) (4 diffs)
-
wifidog/classes/Statistics.php (modified) (1 diff)
-
wifidog/local_content/default/stylesheet.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/ChangeLog
r723 r726 1 2005-09-08 Philippe April <philippe@ilesansfil.org> 2 * New stats system with graphs 3 * Changed the UI a bit to reflect this change 4 * Updated stylesheet 5 1 6 2005-09-08 Benoit Grégoire <bock@step.polymtl.ca> 2 7 * portal/index.php: Custom portal redirect now operational. -
trunk/wifidog-auth/wifidog/admin/online_users.php
r568 r726 41 41 $ui->setMainContent($smarty->fetch("admin/templates/online_users.html")); 42 42 $ui->display(); 43 //$smarty->display("admin/templates/online_users.html");44 43 ?> -
trunk/wifidog-auth/wifidog/admin/templates/online_users.html
r647 r726 5 5 {else} 6 6 7 <div id="node_list"> 7 <fieldset class='pretty_fieldset'> 8 <legend>Online users</legend> 8 9 <table> 10 11 <thead> 9 12 <tr> 10 <th>Node</th>11 <th>Username</th>12 <th>Origin</th>13 <th>Logged in Since</th>14 <th>Traffic IN/OUT</th>13 <th>Node</th> 14 <th>Username</th> 15 <th>Origin</th> 16 <th>Logged in Since</th> 17 <th>Traffic IN/OUT</th> 15 18 </tr> 19 </thead> 20 16 21 {section name=i loop=$users_array} 17 <tr >22 <tr class='{cycle values="odd,even"}'> 18 23 <td>{$users_array[i].name}</td> 19 24 <td><a href="user_log.php?user_id={$users_array[i].user_id}">{$users_array[i].username}</a></td> … … 25 30 {/section} 26 31 </table> 27 </div> 28 <br> 32 </fieldset> 29 33 30 34 {/if} -
trunk/wifidog-auth/wifidog/classes/MainUI.php
r722 r726 108 108 $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; 109 109 $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; 110 $html .= "<li><a href='user_stats.php'>"._("Cumulative user statistics")."</a></li>\n"; 111 $html .= "<li><a href='hotspot_log.php'>"._("Hotspot logs")."</a></li>\n"; 110 $html .= "<li><a href='stats.php'>"._("Statistics")."</a></li>\n"; 112 111 $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; 113 112 $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; -
trunk/wifidog-auth/wifidog/classes/Network.php
r721 r726 244 244 } 245 245 246 /** 247 * Retrieves the network's creation date 248 * @return A string 249 */ 250 public function getCreationDate() 251 { 252 return $this->mRow['creation_date']; 253 } 254 246 255 /** Retreives the network's homepage url 247 256 * @return The id */ … … 402 411 public function getMultipleLoginAllowed() 403 412 { 404 ($this->mRow['allow_multiple_login']=='t')?$retval=true:$retval=false; 405 return $retval; 413 return ($this->mRow['allow_multiple_login'] == 't') ? true : false; 406 414 } 407 415 -
trunk/wifidog-auth/wifidog/classes/Node.php
r716 r726 320 320 } 321 321 322 function getCreationDate() 323 { 324 return $this->mRow['creation_date']; 325 } 326 322 327 function getHomePageURL() 323 328 { … … 473 478 $status = $this->mDb->EscapeString($status); 474 479 $this->mDb->ExecSqlUpdate("UPDATE nodes SET node_deployment_status = '{$status}' WHERE node_id = '{$this->getId()}'"); 480 $this->refresh(); 481 } 482 483 function getLastPaged() 484 { 485 return $this->mRow['last_paged']; 486 } 487 488 function getLastHeartbeatIP() 489 { 490 return $this->mRow['last_heartbeat_ip']; 491 } 492 493 function getLastHeartbeatUserAgent() 494 { 495 return $this->mRow['last_heartbeat_user_agent']; 496 } 497 498 function getLastHeartbeatTimestamp() 499 { 500 return $this->mRow['last_heartbeat_timestamp']; 501 } 502 503 function setLastHeartbeatTimestamp($timestamp) 504 { 505 $status = $this->mDb->EscapeString($status); 506 $this->mDb->ExecSqlUpdate("UPDATE nodes SET last_heartbeat_timestamp = '{$timestamp}' WHERE node_id = '{$this->getId()}'"); 475 507 $this->refresh(); 476 508 } … … 534 566 } 535 567 536 /** Retr eives the admin interface of this object.568 /** Retrieves the admin interface of this object. 537 569 * @return The HTML fragment for this interface */ 538 570 public function getAdminUI() … … 989 1021 $name = "node_{$this->id}_get_stats"; 990 1022 if (!empty ($_REQUEST[$name])) 991 header("Location: hotspot_log.php?node_id=".urlencode($this->getId()));1023 header("Location: stats.php?node_id=".urlencode($this->getId())); 992 1024 993 1025 // Node configuration section -
trunk/wifidog-auth/wifidog/classes/Statistics.php
r553 r726 91 91 } 92 92 93 public static function getRegistrationsPerMonth( ) {93 public static function getRegistrationsPerMonth($from = '', $to = '', $order = "DESC") { 94 94 global $db; 95 $db->ExecSql("SELECT COUNT(users) AS num_users, date_trunc('month', reg_date) AS month FROM users WHERE account_status = ".ACCOUNT_STATUS_ALLOWED." GROUP BY date_trunc('month', reg_date) ORDER BY month DESC",$results, false); 95 96 if ($from != '' && $to != '') 97 $date_constraint = "AND reg_date >= '$from' AND reg_date <= '$to'"; 98 else 99 $date_constraint = ''; 100 101 $db->ExecSql("SELECT COUNT(users) AS num_users, date_trunc('month', reg_date) AS month FROM users WHERE account_status = ".ACCOUNT_STATUS_ALLOWED." ${date_constraint} GROUP BY date_trunc('month', reg_date) ORDER BY month $order",$results, false); 96 102 return $results; 97 103 } 98 104 99 public static function get MostMobileUsers($limit) {105 public static function getRegistrationsPerNode($from = '', $to = '') { 100 106 global $db; 101 $db->ExecSql("SELECT COUNT(DISTINCT node_id) AS num_hotspots_visited, user_id, username, account_origin FROM users NATURAL JOIN connections WHERE (incoming!=0 OR outgoing!=0) GROUP BY account_origin, username,user_id ORDER BY num_hotspots_visited DESC LIMIT $limit", $results, false); 107 108 if ($from != '' && $to != '') 109 $date_constraint = "AND timestamp_in BETWEEN '$from' AND '$to'"; 110 else 111 $date_constraint = ''; 112 113 $db->ExecSql("SELECT nodes.name,connections.node_id,COUNT(user_id) as registrations FROM connections,nodes WHERE timestamp_in IN (SELECT MIN(timestamp_in) as first_connection FROM connections GROUP BY user_id) ${date_constraint} AND nodes.node_id=connections.node_id GROUP BY connections.node_id,nodes.name ORDER BY registrations DESC", $results, false); 102 114 return $results; 103 115 } 104 116 105 public static function get MostFrequentUsers($limit) {117 public static function getNodesUsage($from = '', $to = '') { 106 118 global $db; 107 $db->ExecSql("SELECT COUNT(user_active_days.user_id) AS active_days, user_active_days.user_id, username, account_origin FROM (SELECT DISTINCT user_id, date_trunc('day', timestamp_in) AS date FROM connections WHERE (incoming!=0 OR outgoing!=0) GROUP BY date,user_id) user_active_days JOIN users ON (users.user_id = user_active_days.user_id) GROUP BY account_origin, username, user_active_days.user_id ORDER BY active_days DESC LIMIT $limit",$results, false); 119 120 if ($from != '' && $to != '') 121 $date_constraint = "AND timestamp_in BETWEEN '$from' AND '$to'"; 122 else 123 $date_constraint = ''; 124 125 $db->ExecSql("SELECT nodes.name,connections.node_id,COUNT(connections.node_id) AS connections FROM connections,nodes WHERE nodes.node_id=connections.node_id ${date_constraint} GROUP BY connections.node_id,nodes.name ORDER BY connections DESC;", $results, false); 108 126 return $results; 109 127 } 110 128 111 public static function getMost GreedyUsers($limit) {129 public static function getMostMobileUsers($limit, $from = '', $to = '') { 112 130 global $db; 113 $db->ExecSql("SELECT DISTINCT connections.user_id, SUM((incoming+outgoing)/1048576) AS total, SUM((incoming/1048576)) AS total_incoming, SUM((outgoing/1048576)) AS total_outgoing, username, account_origin FROM connections JOIN users ON (users.user_id = connections.user_id) WHERE incoming IS NOT NULL AND outgoing IS NOT NULL GROUP BY account_origin, username,connections.user_id ORDER BY total DESC limit $limit", $results, false); 131 132 if ($from != '' && $to != '') 133 $date_constraint = "AND timestamp_in >= '$from' AND timestamp_out <= '$to'"; 134 else 135 $date_constraint = ''; 136 137 $db->ExecSql("SELECT COUNT(DISTINCT node_id) AS num_hotspots_visited, user_id, username, account_origin FROM users NATURAL JOIN connections WHERE (incoming!=0 OR outgoing!=0) ${date_constraint} GROUP BY account_origin, username,user_id ORDER BY num_hotspots_visited DESC LIMIT $limit", $results, false); 138 return $results; 139 } 140 141 public static function getMostFrequentUsers($limit, $from = '', $to = '') { 142 global $db; 143 144 if ($from != '' && $to != '') 145 $date_constraint = "AND timestamp_in >= '$from' AND timestamp_out <= '$to'"; 146 else 147 $date_constraint = ''; 148 149 $db->ExecSql("SELECT COUNT(user_active_days.user_id) AS active_days, user_active_days.user_id, username, account_origin FROM (SELECT DISTINCT user_id, date_trunc('day', timestamp_in) AS date FROM connections WHERE (incoming!=0 OR outgoing!=0) ${date_constraint} GROUP BY date,user_id) user_active_days JOIN users ON (users.user_id = user_active_days.user_id) GROUP BY account_origin, username, user_active_days.user_id ORDER BY active_days DESC LIMIT $limit",$results, false); 150 return $results; 151 } 152 153 public static function getMostGreedyUsers($limit, $from = '', $to = '') { 154 global $db; 155 156 if ($from != '' && $to != '') 157 $date_constraint = "AND timestamp_in >= '$from' AND timestamp_out <= '$to'"; 158 else 159 $date_constraint = ''; 160 161 $db->ExecSql("SELECT DISTINCT connections.user_id, SUM(incoming+outgoing) AS total, SUM(incoming) AS total_incoming, SUM(outgoing) AS total_outgoing, username, account_origin FROM connections JOIN users ON (users.user_id = connections.user_id) WHERE incoming IS NOT NULL AND outgoing IS NOT NULL ${date_constraint} GROUP BY account_origin, username,connections.user_id ORDER BY total DESC limit $limit", $results, false); 114 162 return $results; 115 163 } -
trunk/wifidog-auth/wifidog/local_content/default/stylesheet.css
r685 r726 481 481 #std_table td.item { font-weight: bold; } 482 482 483 .pretty_fieldset { 484 background-color: #e1f5da; 485 font-family: Verdana, Arial, Helvetica, sans-serif; 486 } 487 .pretty_fieldset legend { 488 font-size: 14pt; 489 } 490 .pretty_fieldset table { 491 width: 100%; 492 border-collapse: collapse; 493 } 494 .pretty_fieldset tr.odd { 495 background-color: #d1e5ca; 496 } 497 .pretty_fieldset th { 498 text-align: left; 499 text-transform: uppercase; 500 width: 200px; 501 } 502 503 .pretty_fieldset div { 504 border: 1px dotted black; 505 background-color: #fff; 506 } 507 508 .pretty_fieldset .red { 509 background-color: red; 510 } 511 512 .smaller { 513 font-size: 80%; 514 } 515 483 516 /* Google Maps stuff */ 484 517 #map_hotspots_list {
