$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: grafikrobot_at_[hidden]
Date: 2007-07-27 20:03:52
Author: grafik
Date: 2007-07-27 20:03:52 EDT (Fri, 27 Jul 2007)
New Revision: 7569
URL: http://svn.boost.org/trac/boost/changeset/7569
Log:
Add page to display irc stats. And add the IBD project stats.
Added:
   website/public_html/beta/common/code/boost_irc_stats.php   (contents, props changed)
   website/public_html/beta/community/irc_stats_ibd.php   (contents, props changed)
Text files modified: 
   website/public_html/beta/common/code/boost_config.php |     2 +-                                      
   website/public_html/beta/common/menu-community.html   |     9 +++++++++                               
   2 files changed, 10 insertions(+), 1 deletions(-)
Modified: website/public_html/beta/common/code/boost_config.php
==============================================================================
--- website/public_html/beta/common/code/boost_config.php	(original)
+++ website/public_html/beta/common/code/boost_config.php	2007-07-27 20:03:52 EDT (Fri, 27 Jul 2007)
@@ -20,7 +20,7 @@
   case 'localhost':
   case 'boost.borg.redshift-software.com':
   {
-    define('BOOST_CONFIG_FILE','/DevRoots/Boost-SVN/website/workplace/config.php');
+    define('BOOST_CONFIG_FILE','/DevRoots/Boost/website/workplace/config.php');
     define('ARCHIVE_PREFIX', '/DevRoots/Boost/boost_');
     define('UNZIP', 'unzip');
   }
Added: website/public_html/beta/common/code/boost_irc_stats.php
==============================================================================
--- (empty file)
+++ website/public_html/beta/common/code/boost_irc_stats.php	2007-07-27 20:03:52 EDT (Fri, 27 Jul 2007)
@@ -0,0 +1,160 @@
+<?php
+/*
+  Copyright 2005-2006 Redshift Software, Inc.
+  Distributed under the Boost Software License, Version 1.0.
+  (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+*/
+require_once(dirname(__FILE__) . '/boost_config.php');
+
+
+function _preg_replace_bounds($front_regex,$back_regex,$front_replace,$back_replace,$text)
+{
+    $offset = 0;
+    $result = '';
+    while (TRUE)
+    {
+        $subject = substr($text,$offset);
+        if (preg_match($front_regex,$subject,$begin,PREG_OFFSET_CAPTURE) == 0 ||
+            preg_match($back_regex,$subject,$end,PREG_OFFSET_CAPTURE,
+                $begin[0][1]+strlen($begin[0][0])) == 0
+            )
+        { break; }
+        else
+        {
+            $result .= substr($subject,0,$begin[0][1]);
+            $result .= preg_replace($front_regex,$front_replace,$begin[0][0]);
+            $result .= substr(
+                $subject,
+                $begin[0][1]+strlen($begin[0][0]),
+                $end[0][1]-($begin[0][1]+strlen($begin[0][0])) );
+            $result .= preg_replace($back_regex,$back_replace,$end[0][0]);
+            $offset += $end[0][1]+strlen($end[0][0]);
+        }
+    }
+    if ($result === '') { return $text; }
+    else { return $result . substr($text,$offset); }
+}
+
+class boost_irc_stats
+{
+    var $head_content_ = NULL;
+    var $content_ = NULL;
+    
+    function boost_irc_stats($uri)
+    {
+        $context = NULL;
+        $this->content_ = file_get_contents($uri,false,$context);
+        
+        if ($this->content_ && $this->content_ != '')
+        {
+            $this->_init_html();
+        }
+        
+        $this->head_content_ .= <<<HTML
+  
+  <!-- IRC STATS URI == '${uri}' -->
+  
+HTML
+            ;
+    }
+    
+    function content_head()
+    {
+        print $this->head_content_;
+    }
+    
+    function content()
+    {
+        if ($this->content_ && $this->content_ != '')
+        {
+            $this->_content_html();
+        }
+    }
+
+    function _init_html()
+    {
+        preg_match('@text/html; charset=([^\s"]+)@i',$this->content_,$charset);
+        if (isset($charset[1]))
+        {
+            $this->head_content_ .= <<<HTML
+  <meta http-equiv="Content-Type" content="text/html; charset=${charset[1]}" />
+HTML
+                ;
+        }
+        else
+        {
+            $this->head_content_ .= <<<HTML
+  <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
+HTML
+                ;
+        }
+        
+        preg_match('@<title>([^<]+)</title>@i',$this->content_,$title);
+        if (isset($title[1]))
+        {
+            $this->head_content_ .= <<<HTML
+  <title>Boost C++ Libraries - ${title[1]}</title>
+HTML
+                ;
+        }
+        else
+        {
+            $this->head_content_ .= <<<HTML
+  <title>Boost C++ Libraries - Wiki</title>
+HTML
+                ;
+        }
+    }
+    
+    function _content_html()
+    {
+        $text = $this->content_;
+        
+        $text = preg_replace(
+            '@href="?http://www.boost.org/?([^"\s]*)"?@i',
+            'href="/${1}"',
+            $text );
+        $text = preg_replace(
+            '@href="?(?:\.\./)+people/(.*\.htm)"?@i',
+            'href="/users/people/${1}l"',
+            $text );
+        $text = preg_replace(
+            '@href="?(?:\.\./)+(LICENSE_.*\.txt)"?@i',
+            'href="/${1}"',
+            $text );
+        $text = preg_replace(
+            '@<a\s+(class="[^"]+")?\s*href="?(http|mailto)(:[^"\s]*)"?@i',
+            '<a class="external" href="${2}${3}"',
+            $text );
+        
+        preg_match('@<body>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
+        preg_match('@</body>@i',$text,$body_end,PREG_OFFSET_CAPTURE);
+        if (!isset($body_begin[0]))
+        {
+            return;
+        }
+        else if (!isset($body_end[0]))
+        {
+            $text = substr($text,
+                $body_begin[0][1]+strlen($body_begin[0][0]));
+        }
+        else
+        {
+            $text = substr($text,
+                $body_begin[0][1]+strlen($body_begin[0][0]),
+                $body_end[0][1]-($body_begin[0][1]+strlen($body_begin[0][0])) );
+        }
+        
+        $text = preg_replace(
+            '@<[/]?(font|hr)[^>]*>@i',
+            '',
+            $text );
+        $text = preg_replace(
+            '@[\s]+(border|cellpadding|cellspacing|width|height|valign|align|frame|rules|naturalsizeflag|background|wrap)=[^\s>]+@i',
+            '',
+            $text );
+        
+        print $text;
+    }
+}
+?>
Modified: website/public_html/beta/common/menu-community.html
==============================================================================
--- website/public_html/beta/common/menu-community.html	(original)
+++ website/public_html/beta/common/menu-community.html	2007-07-27 20:03:52 EDT (Fri, 27 Jul 2007)
@@ -29,4 +29,13 @@
 
     <li><a href="http://www.boost-consulting.com/vault/" class=
     "external">Vault <span class="link">></span></a></li>
+
+    <li>
+      IRC >
+
+      <ul>
+        <li><a href="/community/irc_stats_ibd.php">IDB Stats <span class=
+        "link">></span></a></li>
+      </ul>
+    </li>
   </ul>
Added: website/public_html/beta/community/irc_stats_ibd.php
==============================================================================
--- (empty file)
+++ website/public_html/beta/community/irc_stats_ibd.php	2007-07-27 20:03:52 EDT (Fri, 27 Jul 2007)
@@ -0,0 +1,59 @@
+<?php
+require_once(dirname(__FILE__) . '/../common/code/boost_irc_stats.php');
+
+$_irc = new boost_irc_stats('http://www.acc.umu.se/~zao/stats/ibd.html');
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+  <?php $_irc->content_head(); ?>
+  <link rel="icon" href="/favicon.ico" type="image/ico" />
+  <link rel="stylesheet" type="text/css" href="/style/section-doc.css" />
+  <!--[if IE]> <style type="text/css"> body { behavior: url(/style/csshover.htc); } </style> <![endif]-->
+</head>
+
+<body>
+  <div id="heading">
+    <?php virtual("/common/heading.html"); ?>
+  </div>
+
+  <div id="body">
+    <div class="section section-0" id="content">
+      <div class="section-title">
+        <h1>Boost C++ Libraries - IRC Stats (#ibd)</h1>
+      </div>
+
+      <div class="section-body">
+        <?php $_irc->content(); ?>
+      </div>
+    </div>
+
+    <div id="sidebar">
+      <?php virtual("/common/sidebar-common.html"); ?><?php virtual("/common/sidebar-community.html"); ?>
+    </div>
+
+    <div class="clear"></div>
+  </div>
+
+  <div id="footer">
+    <div id="footer-left">
+      <div id="revised">
+        <p>Revised $Date$</p>
+      </div>
+
+      <div id="copyright">
+        <p>Copyright Rene Rivera 2007.</p>
+      </div><?php virtual("/common/footer-license.html"); ?>
+    </div>
+
+    <div id="footer-right">
+      <?php virtual("/common/footer-banners.html"); ?>
+    </div>
+
+    <div class="clear"></div>
+  </div>
+</body>
+</html>