htdocs/index.php
changeset 52 a8f0e99883d1
parent 46 186507f67064
equal deleted inserted replaced
51:508400fc5282 52:a8f0e99883d1
     1 <?php
     1 <?php
     2 require('../stats-fe.php');
     2 require_once('../stats-fe.php');
     3 require('../timezone.php');
     3 require_once('../timezone.php');
     4 
     4 
     5 $channel_list = stats_channel_list();
     5 $channel_list = stats_channel_list();
     6 $first_channel = $channel_list[0];
     6 $first_channel = $channel_list[0];
     7 $channel = ( isset($_REQUEST['channel']) && in_array($_REQUEST['channel'], $channel_list) ) ? $_REQUEST['channel'] : $first_channel;
     7 $channel = ( isset($_REQUEST['channel']) && in_array($_REQUEST['channel'], $channel_list) ) ? $_REQUEST['channel'] : $first_channel;
     8 
     8 
     9 $title = "$nick - Statistics";
     9 $title = "$nick - Statistics";
    10 require("./themes/$webtheme/header.php");
    10 require("./themes/$webtheme/header.php");
    11 ?>
    11 ?>
       
    12     <script type="text/javascript" src="ajax-update.js"></script>
    12     <div style="float: right;">
    13     <div style="float: right;">
    13       <p>
    14       <p>
    14         <?php
    15         <?php
    15         $tz_display = str_replace('_', ' ', str_replace('/', ': ', $tz));
    16         $tz_display = str_replace('_', ' ', str_replace('/', ': ', $tz));
    16         echo 'Time zone: ' . $tz_display . ' [<a href="changetz.php">change</a>]<br />';
    17         echo 'Time zone: ' . $tz_display . ' [<a href="changetz.php">change</a>]<br />';
    30             echo $bold ? '</b>' : '';
    31             echo $bold ? '</b>' : '';
    31             echo $i == count($channels) - 1 ? '' : ' | ';
    32             echo $i == count($channels) - 1 ? '' : ' | ';
    32           }
    33           }
    33         ?>
    34         ?>
    34       </p>
    35       </p>
       
    36       <p>Update every <input id="update_ivl" size="3" value="..." style="text-align: center;" /> seconds<br />
       
    37          <small>(Javascript required, min. 5 secs, default 30)</small><br />
       
    38          </p>
    35     </div>
    39     </div>
    36     <h1>Active members</h1>
    40     <div id="active-members">
    37     <p>For the last 1, 5, and 15 minutes:
       
    38         <?php echo count(stats_activity_percent($channel, 1)) . ', ' .
       
    39                    count(stats_activity_percent($channel, 5)) . ', ' .
       
    40                    count(stats_activity_percent($channel, 15)) . ' (respectively)';
       
    41         ?>
       
    42         </p>
       
    43     <h1>Currently active members:</h1>
       
    44     <p>These people have posted in the last 3 minutes:</p>
       
    45     <ul>
       
    46       <?php
    41       <?php
    47       $datum = stats_activity_percent($channel, 3);
    42       require('ajax-active.php');
    48       $count = stats_message_count($channel, 3);
       
    49       if ( empty($datum) )
       
    50         echo '<li>No recent posts.</li>';
       
    51       foreach ( $datum as $usernick => $pct )
       
    52       {
       
    53         $total = round($pct * $count);
       
    54         $pct = round(100 * $pct, 1);
       
    55         echo "<li>$usernick - $pct% ($total)</li>\n";
       
    56       }
       
    57       ?>
    43       ?>
    58     </ul>
    44     </div>
    59     <p>Last 20 minutes:</p>
       
    60     <ul>
       
    61       <?php
       
    62       $datum = stats_activity_percent($channel, 20);
       
    63       $count = stats_message_count($channel, 20);
       
    64       if ( empty($datum) )
       
    65         echo '<li>No recent posts.</li>';
       
    66       foreach ( $datum as $usernick => $pct )
       
    67       {
       
    68         $total = round($pct * $count);
       
    69         $pct = round(100 * $pct, 1);
       
    70         echo "<li>$usernick - $pct% ($total)</li>\n";
       
    71       }
       
    72       ?>
       
    73     </ul>
       
    74     <h1>Last 60 minutes</h1>
    45     <h1>Last 60 minutes</h1>
    75     <img alt="Graph image" src="graph.php?mode=lasthour&amp;channel=<?php echo urlencode($channel); ?>" />
    46     <img class="graph" alt="Graph image" src="graph.php?mode=lasthour&amp;channel=<?php echo urlencode($channel); ?>" />
    76     <h1>Last 24 hours</h1>
    47     <h1>Last 24 hours</h1>
    77     <img alt="Graph image" src="graph.php?mode=lastday&amp;channel=<?php echo urlencode($channel); ?>" />
    48     <img class="graph" alt="Graph image" src="graph.php?mode=lastday&amp;channel=<?php echo urlencode($channel); ?>" />
    78     <h1>Last 2 weeks</h1>
    49     <h1>Last 2 weeks</h1>
    79     <img alt="Graph image" src="graph.php?mode=lastweek&amp;channel=<?php echo urlencode($channel); ?>" />
    50     <img class="graph" alt="Graph image" src="graph.php?mode=lastweek&amp;channel=<?php echo urlencode($channel); ?>" />
    80 <?php
    51 <?php
    81 require("./themes/$webtheme/footer.php");
    52 require("./themes/$webtheme/footer.php");
    82 
    53