htdocs/index.php
author Dan
Tue, 20 Jan 2009 22:08:07 -0500
changeset 51 508400fc5282
parent 46 186507f67064
child 52 a8f0e99883d1
permissions -rw-r--r--
Major change to permissions backend - performs whois check (only supported blitzed and freenode right now) and advanced permissions supported.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     1
<?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     2
require('../stats-fe.php');
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     3
require('../timezone.php');
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     4
20
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
     5
$channel_list = stats_channel_list();
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
     6
$first_channel = $channel_list[0];
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
     7
$channel = ( isset($_REQUEST['channel']) && in_array($_REQUEST['channel'], $channel_list) ) ? $_REQUEST['channel'] : $first_channel;
44
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
     8
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
     9
$title = "$nick - Statistics";
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    10
require("./themes/$webtheme/header.php");
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    11
?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    12
    <div style="float: right;">
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    13
      <p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    14
        <?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    15
        $tz_display = str_replace('_', ' ', str_replace('/', ': ', $tz));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    16
        echo 'Time zone: ' . $tz_display . ' [<a href="changetz.php">change</a>]<br />';
20
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 15
diff changeset
    17
        echo '<small>The time now is ' . date('H:i:s') . '.<br />Statistics now updated constantly (see <a href="news.php">news</a>)</small>';
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    18
        ?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    19
      </p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    20
      <p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    21
        <big><b>Channels:</b></big><br />
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    22
        <?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    23
          foreach ( $channels as $i => $c )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    24
          {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    25
            $bold = ( $c == $channel );
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    26
            echo $bold ? '<b>' : '';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    27
            echo $bold ? '' : '<a href="index.php?channel=' . urlencode($c) . '">';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    28
            echo $c;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    29
            echo $bold ? '' : '</a>';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    30
            echo $bold ? '</b>' : '';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    31
            echo $i == count($channels) - 1 ? '' : ' | ';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    32
          }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    33
        ?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    34
      </p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    35
    </div>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    36
    <h1>Active members</h1>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    37
    <p>For the last 1, 5, and 15 minutes:
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    38
        <?php echo count(stats_activity_percent($channel, 1)) . ', ' .
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    39
                   count(stats_activity_percent($channel, 5)) . ', ' .
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    40
                   count(stats_activity_percent($channel, 15)) . ' (respectively)';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    41
        ?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    42
        </p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    43
    <h1>Currently active members:</h1>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    44
    <p>These people have posted in the last 3 minutes:</p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    45
    <ul>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    46
      <?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    47
      $datum = stats_activity_percent($channel, 3);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    48
      $count = stats_message_count($channel, 3);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    49
      if ( empty($datum) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    50
        echo '<li>No recent posts.</li>';
11
b3fec7467c05 Fixed $nick being overwritten in index
Dan
parents: 8
diff changeset
    51
      foreach ( $datum as $usernick => $pct )
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    52
      {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    53
        $total = round($pct * $count);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    54
        $pct = round(100 * $pct, 1);
11
b3fec7467c05 Fixed $nick being overwritten in index
Dan
parents: 8
diff changeset
    55
        echo "<li>$usernick - $pct% ($total)</li>\n";
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    56
      }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    57
      ?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    58
    </ul>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    59
    <p>Last 20 minutes:</p>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    60
    <ul>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    61
      <?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    62
      $datum = stats_activity_percent($channel, 20);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    63
      $count = stats_message_count($channel, 20);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    64
      if ( empty($datum) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    65
        echo '<li>No recent posts.</li>';
11
b3fec7467c05 Fixed $nick being overwritten in index
Dan
parents: 8
diff changeset
    66
      foreach ( $datum as $usernick => $pct )
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    67
      {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    68
        $total = round($pct * $count);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    69
        $pct = round(100 * $pct, 1);
11
b3fec7467c05 Fixed $nick being overwritten in index
Dan
parents: 8
diff changeset
    70
        echo "<li>$usernick - $pct% ($total)</li>\n";
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    71
      }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    72
      ?>
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    73
    </ul>
45
53a50ba4d690 Added last 60 minutes graph to index.php
Dan
parents: 34
diff changeset
    74
    <h1>Last 60 minutes</h1>
53a50ba4d690 Added last 60 minutes graph to index.php
Dan
parents: 34
diff changeset
    75
    <img alt="Graph image" src="graph.php?mode=lasthour&amp;channel=<?php echo urlencode($channel); ?>" />
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    76
    <h1>Last 24 hours</h1>
34
a8daa2016cf1 Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents: 20
diff changeset
    77
    <img alt="Graph image" src="graph.php?mode=lastday&amp;channel=<?php echo urlencode($channel); ?>" />
a8daa2016cf1 Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents: 20
diff changeset
    78
    <h1>Last 2 weeks</h1>
a8daa2016cf1 Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Dan
parents: 20
diff changeset
    79
    <img alt="Graph image" src="graph.php?mode=lastweek&amp;channel=<?php echo urlencode($channel); ?>" />
44
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    80
<?php
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    81
require("./themes/$webtheme/footer.php");
73f74d395f95 Added theme support. Oh yeah, you can customize graphs using graph_{line,bar}.def.
Dan
parents: 34
diff changeset
    82