[PC-BSD Commits] r2170 - in websites: bsdstats.org bsdstats.org/_includes bsdstats.org/_includes/Stats bsdstats.org/bsdstats/bin bsdstats.org/bsdstats/etc bsdstats.org/bsdstats/slib bsdstats.org/bsdstats/slib/db bsdstats.org/bsdstats/tpl bsdstats.org/bsdstats/tpl/bsdstats bsdstats.org/bsdstats/tpl/css bsdstats.org/bsdstats/tpl/display pbidir.com pbidir.com/bibivu/slib pbidir.com/bibivu/slib/db

svn at pcbsd.org svn at pcbsd.org
Tue Jun 24 21:52:13 PDT 2008


Author: fabry
Date: 2008-06-24 21:52:12 -0700 (Tue, 24 Jun 2008)
New Revision: 2170

Added:
   websites/bsdstats.org/bsdstats/tpl/bsdstats/
   websites/bsdstats.org/bsdstats/tpl/bsdstats/foot_menu.php
   websites/bsdstats.org/bsdstats/tpl/bsdstats/footer.php
   websites/bsdstats.org/bsdstats/tpl/bsdstats/header.php
   websites/bsdstats.org/bsdstats/tpl/bsdstats/home.php
   websites/bsdstats.org/bsdstats/tpl/bsdstats/instructions.php
   websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php
   websites/bsdstats.org/bsdstats/tpl/css/bsdstats.css
   websites/bsdstats.org/bsdstats/tpl/display/message.php
   websites/pbidir.com/bibivu/slib/db/pgsql.php
Modified:
   websites/bsdstats.org/.htaccess
   websites/bsdstats.org/_includes/BSDSmarty.class.php
   websites/bsdstats.org/_includes/Stats/BSDStatsCountry.class.php
   websites/bsdstats.org/_includes/Stats/BSDStatsSummary.class.php
   websites/bsdstats.org/bsdstats/bin/start.php
   websites/bsdstats.org/bsdstats/etc/display.conf.php
   websites/bsdstats.org/bsdstats/slib/db/pgsql.php
   websites/bsdstats.org/bsdstats/slib/format.php
   websites/bsdstats.org/index.php
   websites/pbidir.com/.htaccess
   websites/pbidir.com/bibivu/slib/format.php
Log:
a few updates to bsdstats.org.  Starting to create the pages.

Modified: websites/bsdstats.org/.htaccess
===================================================================
--- websites/bsdstats.org/.htaccess	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/.htaccess	2008-06-25 04:52:12 UTC (rev 2170)
@@ -1,11 +1,9 @@
 RewriteEngine On
 
-RewriteRule ^rss/recent.rdf$ /bt/rss/pbi.rss [NC,L]
+RewriteCond %{REQUEST_URI} !.php|.css|.js|.jpg|.jpeg|.gif|.png|.txt|.statistics|.sh$
+	RewriteRule ^(.*)$ /index_new.php/$1 [L]
 
-RewriteCond %{REQUEST_URI} !.php|.css|.js|.jpg|.jpeg|.gif|.png|.txt$
-	RewriteRule ^(.*)$ /index.php/$1 [L]
 
-
 ###############################################
 #turning off safe_mode
 php_flag safe_mode off
@@ -19,4 +17,4 @@
 #the next line is not necessary for Fabrizio Parrella stats
 php_value include_path ".:/usr/local/share/pear:/usr/local/www/bsdstats.org/www/_includes"
 #the next line has been removed for security
-#php_flag display_errors On
+php_flag display_errors On

Modified: websites/bsdstats.org/_includes/BSDSmarty.class.php
===================================================================
--- websites/bsdstats.org/_includes/BSDSmarty.class.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/_includes/BSDSmarty.class.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -1,19 +1,19 @@
-<?php
-//
-// BSDSmarty
-// Wrapper class for Smarty, for use on bsdstats.org
-//
-
-require_once('Smarty/Smarty.class.php');
-
-class BSDSmarty extends Smarty {
-    function BSDSmarty($osname = false) {
-        $this->template_dir = '/usr/local/www/bsdstats.org/www/_templates/';
-        $this->compile_dir  = '/usr/local/www/bsdstats.org/www/_tpl_c/';
-        //        $this->use_sub_dirs = true;
-
-        if ($osname) {
-            $this->assign('osname', $osname);
-        }
-    }
-}
+<?php
+//
+// BSDSmarty
+// Wrapper class for Smarty, for use on bsdstats.org
+//
+
+require_once('Smarty-2.6.14/Smarty.class.php');
+
+class BSDSmarty extends Smarty {
+    function BSDSmarty($osname = false) {
+        $this->template_dir = '/usr/local/www/bsdstats.org/www/_templates/';
+        $this->compile_dir  = '/usr/local/www/bsdstats.org/www/_tpl_c/';
+        //        $this->use_sub_dirs = true;
+
+        if ($osname) {
+            $this->assign('osname', $osname);
+        }
+    }
+}

Modified: websites/bsdstats.org/_includes/Stats/BSDStatsCountry.class.php
===================================================================
--- websites/bsdstats.org/_includes/Stats/BSDStatsCountry.class.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/_includes/Stats/BSDStatsCountry.class.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -1,128 +1,128 @@
-<?php
-
-require_once('BSDStats.class.php');
-
-class BSDStatsSummary extends BSDStats {
-    // Constructor
-    function BSDStatsSummary() {
-        // Call parent constructor
-        parent::BSDStats();
-    }
-
-    function GetSystemsByOS() {
-        // Create a database connection
-        $this->_connectDB();
-
-        // Retrieve the standard SQL statement and modify it
-        $sql = preg_replace('/(count\(1\).+)(ORDER BY.+)/s',
-                            'operating_system, $1
-                             GROUP BY operating_system $2',
-                            $this->_sqlGetNumberOfSystems('operating_system'));
-        // Query the database
-        $res = pg_query($this->_conn, $sql);
-
-        $total_systems = 0;
-        for ($i=0; $i < pg_numrows($res); $i++) {
-            $this_os = pg_fetch_result($res, $i, 'operating_system');
-            $rv[$this_os]['count'] = pg_fetch_result($res, $i, 'count');
-            $total_systems += $rv[$this_os]['count'];
-        }
-
-        // Fill in the percentages
-        foreach ($rv as $rv_os => $rv_arr) {
-            $rv[$rv_os]['percentage'] = $rv_arr['count'] / $total_systems * 100;
-        }
-
-        return $rv;
-    }
-
-
-    // Get the number of systems by country
-    function GetCountries() {
-        // Create a database connection
-        $this->_connectDB();
-
-        // Get the total number of systems
-        $total_systems = $this->GetNumberOfSystems();
-
-        // Build the query string
-//        $sql = "SELECT long AS country,
-//                       short AS country_code,
-//                       count(1)
-//                FROM systems s, system_ids si
-//                  LEFT JOIN country_codes ON ( country_code = short )
-//                WHERE DATE_TRUNC('month', s.report_month) = DATE_TRUNC('month', now())
-//                  AND s.id = si.id 
-//                GROUP BY long, short
-//                ORDER BY count DESC ";
-        $sql = "SELECT long AS country,
-                       short AS country_code,
-                       count(1)
-                  FROM ( SELECT id, MAX(report_month)
-                           FROM list_countries
-                       GROUP BY id ) AS lc2,
-                       list_countries lc
-             LEFT JOIN country_codes ON ( country_code = short )
-                 WHERE lc.report_month = lc2.max
-                   AND lc.id = lc2.id 
- AND short = 'US'
-              GROUP BY long, short
-              ORDER BY count DESC ";
-
-        if ($limit)
-            $sql .= "LIMIT $limit ";
-        $res = pg_query($this->_conn, $sql);
-
-        // Retrieve the OS counts for each country
-        for ($i=0; $i < pg_num_rows($res); $i++) {
-            // Retrieve the OS counts for the country
-            $data = pg_fetch_object($res, $i);
-//            $os = pg_query($this->_conn, "
-//                SELECT operating_system, count(1)
-//                FROM systems s, system_ids si, operating_systems os
-//                WHERE DATE_TRUNC('month', s.report_month) = DATE_TRUNC('month', now())
-//                  AND s.id = si.id
-//                  AND country_code = '$data->country_code'
-//                  AND os_id = os.id
-//                  GROUP BY operating_system;");
-            $os = pg_query($this->_conn, "
-                SELECT operating_system, count(1)
-                FROM list_countries lc, operating_systems os,
-                     ( SELECT id, MAX(report_month)
-                           FROM list_countries
-                       GROUP BY id ) AS lc2
-                WHERE os.id = os_id
-                  AND lc2.id = lc.id
-                  AND lc.report_month = lc2.max
-                  AND country_code = '$data->country_code'
-                  GROUP BY operating_system;");
-
-
-            // Initialise the country results
-            $os_counts = array();
-            foreach ($this->GetSupportedSystems() as $systype) {
-                $os_counts[$systype] = false;
-            }
-
-            // Add in the country type for supported systems
-            for ($j = 0; $j < pg_numrows($os); $j++) {
-                $osname = pg_fetch_result($os, $j, 'operating_system');
-                if (array_key_exists($osname, $os_counts))
-                    $os_counts[$osname] = pg_fetch_result($os, $j, 'count');
-            }
-
-            // Add the country results to the results array
-            $rv[] = array(
-              'country_code' => $data->country_code,
-              'name' => $data->country,
-              'total_count' => $data->count,
-              'percent' => $data->count / $total_systems * 100,
-              'count' => $os_counts);
-        }
-
-        // Return the completed results
-        return $rv;
-    }
-}
-
-?>
+<?php
+
+require_once('BSDStats.class.php');
+
+class BSDStatsSummary extends BSDStats {
+    // Constructor
+    function BSDStatsSummary() {
+        // Call parent constructor
+        parent::BSDStats();
+    }
+
+    function GetSystemsByOS() {
+        // Create a database connection
+        $this->_connectDB();
+
+        // Retrieve the standard SQL statement and modify it
+        $sql = preg_replace('/(count\(1\).+)(ORDER BY.+)/s',
+                            'operating_system, $1
+                             GROUP BY operating_system $2',
+                            $this->_sqlGetNumberOfSystems('operating_system'));
+        // Query the database
+        $res = pg_query($this->_conn, $sql);
+
+        $total_systems = 0;
+        for ($i=0; $i < pg_numrows($res); $i++) {
+            $this_os = pg_fetch_result($res, $i, 'operating_system');
+            $rv[$this_os]['count'] = pg_fetch_result($res, $i, 'count');
+            $total_systems += $rv[$this_os]['count'];
+        }
+
+        // Fill in the percentages
+        foreach ($rv as $rv_os => $rv_arr) {
+            $rv[$rv_os]['percentage'] = $rv_arr['count'] / $total_systems * 100;
+        }
+
+        return $rv;
+    }
+
+
+    // Get the number of systems by country
+    function GetCountries() {
+        // Create a database connection
+        $this->_connectDB();
+
+        // Get the total number of systems
+        $total_systems = $this->GetNumberOfSystems();
+
+        // Build the query string
+//        $sql = "SELECT long AS country,
+//                       short AS country_code,
+//                       count(1)
+//                FROM systems s, system_ids si
+//                  LEFT JOIN country_codes ON ( country_code = short )
+//                WHERE DATE_TRUNC('month', s.report_month) = DATE_TRUNC('month', now())
+//                  AND s.id = si.id 
+//                GROUP BY long, short
+//                ORDER BY count DESC ";
+        $sql = "SELECT long AS country,
+                       short AS country_code,
+                       count(1)
+                  FROM ( SELECT id, MAX(report_month)
+                           FROM list_countries
+                       GROUP BY id ) AS lc2,
+                       list_countries lc
+             LEFT JOIN country_codes ON ( country_code = short )
+                 WHERE lc.report_month = lc2.max
+                   AND lc.id = lc2.id 
+ AND short = 'US'
+              GROUP BY long, short
+              ORDER BY count DESC ";
+
+        if ($limit)
+            $sql .= "LIMIT $limit ";
+        $res = pg_query($this->_conn, $sql);
+
+        // Retrieve the OS counts for each country
+        for ($i=0; $i < pg_num_rows($res); $i++) {
+            // Retrieve the OS counts for the country
+            $data = pg_fetch_object($res, $i);
+//            $os = pg_query($this->_conn, "
+//                SELECT operating_system, count(1)
+//                FROM systems s, system_ids si, operating_systems os
+//                WHERE DATE_TRUNC('month', s.report_month) = DATE_TRUNC('month', now())
+//                  AND s.id = si.id
+//                  AND country_code = '$data->country_code'
+//                  AND os_id = os.id
+//                  GROUP BY operating_system;");
+            $os = pg_query($this->_conn, "
+                SELECT operating_system, count(1)
+                FROM list_countries lc, operating_systems os,
+                     ( SELECT id, MAX(report_month)
+                           FROM list_countries
+                       GROUP BY id ) AS lc2
+                WHERE os.id = os_id
+                  AND lc2.id = lc.id
+                  AND lc.report_month = lc2.max
+                  AND country_code = '$data->country_code'
+                  GROUP BY operating_system;");
+
+
+            // Initialise the country results
+            $os_counts = array();
+            foreach ($this->GetSupportedSystems() as $systype) {
+                $os_counts[$systype] = false;
+            }
+
+            // Add in the country type for supported systems
+            for ($j = 0; $j < pg_numrows($os); $j++) {
+                $osname = pg_fetch_result($os, $j, 'operating_system');
+                if (array_key_exists($osname, $os_counts))
+                    $os_counts[$osname] = pg_fetch_result($os, $j, 'count');
+            }
+
+            // Add the country results to the results array
+            $rv[] = array(
+              'country_code' => $data->country_code,
+              'name' => $data->country,
+              'total_count' => $data->count,
+              'percent' => $data->count / $total_systems * 100,
+              'count' => $os_counts);
+        }
+
+        // Return the completed results
+        return $rv;
+    }
+}
+
+?>

Modified: websites/bsdstats.org/_includes/Stats/BSDStatsSummary.class.php
===================================================================
--- websites/bsdstats.org/_includes/Stats/BSDStatsSummary.class.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/_includes/Stats/BSDStatsSummary.class.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -1,120 +1,120 @@
-<?php
-
-require_once('BSDStats.class.php');
-
-class BSDStatsSummary extends BSDStats {
-    // Constructor
-    function BSDStatsSummary() {
-        // Call parent constructor
-        parent::BSDStats();
-    }
-
-    function GetSystemsByOS() {
-        // Create a database connection
-        $this->_connectDB();
-
-        // Retrieve the standard SQL statement and modify it
-        $sql = preg_replace('/(count\(1\).+)(ORDER BY.+)/s',
-                            'operating_system, $1
-                             GROUP BY operating_system $2',
-                            $this->_sqlGetNumberOfSystems('operating_system'));
-
-        // Query the database
-        $res = pg_query($this->_conn, $sql);
-
-        $total_systems = 0;
-        for ($i=0; $i < pg_numrows($res); $i++) {
-            $this_os = pg_fetch_result($res, $i, 'operating_system');
-            $rv[$this_os]['count'] = pg_fetch_result($res, $i, 'count');
-            $total_systems += $rv[$this_os]['count'];
-        }
-
-        // Fill in the percentages
-        foreach ($rv as $rv_os => $rv_arr) {
-            $rv[$rv_os]['percentage'] = $rv_arr['count'] / $total_systems * 100;
-        }
-
-        return $rv;
-    }
-
-
-    // Get the number of systems by country
-    function GetCountries($limit = 10) {
-        // Create a database connection
-        $this->_connectDB();
-
-        // Get the total number of systems
-        $total_systems = $this->GetNumberOfSystems();
-
-        // Build the query string
-//        $sql = "SELECT long AS country,
-//                       short AS country_code,
-//                       count(1)
-//                FROM systems s, system_ids si
-//                  LEFT JOIN country_codes ON ( country_code = short )
-//                WHERE DATE_TRUNC('month', s.report_month) = DATE_TRUNC('month', DATE_TRUNC('month', now()))
-//                  AND s.id = si.id 
-//                GROUP BY long, short
-//                ORDER BY count DESC ";
-        $sql = "SELECT long AS country,
-                       short AS country_code,
-                       count(1)" . ($this->_dbsys ? '' : ",
-                       (count(1) / $total_systems)::float4 AS percent " ) . "
-                  FROM ( SELECT id, MAX(report_month)
-                           FROM list_countries
-                       GROUP BY id ) AS lc2,
-                       list_countries lc
-             LEFT JOIN country_codes ON ( country_code = short )
-                 WHERE lc.report_month = lc2.max
-                   AND lc.id = lc2.id 
-              GROUP BY long, short
-              ORDER BY count DESC ";
-
-        if ($limit)
-            $sql .= "LIMIT $limit ";
-        $res = pg_query($this->_conn, $sql);
-
-        // Retrieve the OS counts for each country
-        for ($i=0; $i < pg_num_rows($res); $i++) {
-            // Retrieve the OS counts for the country
-            $data = pg_fetch_object($res, $i);
-            $os = pg_query($this->_conn, "
-                SELECT operating_system, count(1)
-                FROM list_countries lc, operating_systems os,
-                     ( SELECT id, MAX(report_month)
-                           FROM list_countries
-                       GROUP BY id ) AS lc2
-                WHERE os.id = os_id
-                  AND lc2.id = lc.id
-                  AND lc.report_month = lc2.max
-                  AND country_code = '$data->country_code'
-                  GROUP BY operating_system;");
-
-            // Initialise the country results
-            $os_counts = array();
-            foreach ($this->GetSupportedSystems() as $systype) {
-                $os_counts[$systype] = false;
-            }
-
-            // Add in the country type for supported systems
-            for ($j = 0; $j < pg_numrows($os); $j++) {
-                $osname = pg_fetch_result($os, $j, 'operating_system');
-                if (array_key_exists($osname, $os_counts))
-                    $os_counts[$osname] = pg_fetch_result($os, $j, 'count');
-            }
-
-            // Add the country results to the results array
-            $rv[] = array(
-              'country_code' => $data->country_code,
-              'name' => $data->country,
-              'total_count' => $data->count,
-              'percent' => $data->count / $total_systems * 100,
-              'count' => $os_counts);
-        }
-
-        // Return the completed results
-        return $rv;
-    }
-}
-
-?>
+<?php
+
+require_once('BSDStats.class.php');
+
+class BSDStatsSummary extends BSDStats {
+    // Constructor
+    function BSDStatsSummary() {
+        // Call parent constructor
+        parent::BSDStats();
+    }
+
+    function GetSystemsByOS() {
+        // Create a database connection
+        $this->_connectDB();
+
+        // Retrieve the standard SQL statement and modify it
+        $sql = preg_replace('/(count\(1\).+)(ORDER BY.+)/s',
+                            'operating_system, $1
+                             GROUP BY operating_system $2',
+                            $this->_sqlGetNumberOfSystems('operating_system'));
+
+        // Query the database
+        $res = pg_query($this->_conn, $sql);
+
+        $total_systems = 0;
+        for ($i=0; $i < pg_numrows($res); $i++) {
+            $this_os = pg_fetch_result($res, $i, 'operating_system');
+            $rv[$this_os]['count'] = pg_fetch_result($res, $i, 'count');
+            $total_systems += $rv[$this_os]['count'];
+        }
+
+        // Fill in the percentages
+        foreach ($rv as $rv_os => $rv_arr) {
+            $rv[$rv_os]['percentage'] = $rv_arr['count'] / $total_systems * 100;
+        }
+
+        return $rv;
+    }
+
+
+    // Get the number of systems by country
+    function GetCountries($limit = 10) {
+        // Create a database connection
+        $this->_connectDB();
+
+        // Get the total number of systems
+        $total_systems = $this->GetNumberOfSystems();
+
+        // Build the query string
+//        $sql = "SELECT long AS country,
+//                       short AS country_code,
+//                       count(1)
+//                FROM systems s, system_ids si
+//                  LEFT JOIN country_codes ON ( country_code = short )
+//                WHERE DATE_TRUNC('month', s.report_month) = DATE_TRUNC('month', DATE_TRUNC('month', now()))
+//                  AND s.id = si.id 
+//                GROUP BY long, short
+//                ORDER BY count DESC ";
+        $sql = "SELECT long AS country,
+                       short AS country_code,
+                       count(1)" . ($this->_dbsys ? '' : ",
+                       (count(1) / $total_systems)::float4 AS percent " ) . "
+                  FROM ( SELECT id, MAX(report_month)
+                           FROM list_countries
+                       GROUP BY id ) AS lc2,
+                       list_countries lc
+             LEFT JOIN country_codes ON ( country_code = short )
+                 WHERE lc.report_month = lc2.max
+                   AND lc.id = lc2.id 
+              GROUP BY long, short
+              ORDER BY count DESC ";
+
+        if ($limit)
+            $sql .= "LIMIT $limit ";
+        $res = pg_query($this->_conn, $sql);
+
+        // Retrieve the OS counts for each country
+        for ($i=0; $i < pg_num_rows($res); $i++) {
+            // Retrieve the OS counts for the country
+            $data = pg_fetch_object($res, $i);
+            $os = pg_query($this->_conn, "
+                SELECT operating_system, count(1)
+                FROM list_countries lc, operating_systems os,
+                     ( SELECT id, MAX(report_month)
+                           FROM list_countries
+                       GROUP BY id ) AS lc2
+                WHERE os.id = os_id
+                  AND lc2.id = lc.id
+                  AND lc.report_month = lc2.max
+                  AND country_code = '$data->country_code'
+                  GROUP BY operating_system;");
+
+            // Initialise the country results
+            $os_counts = array();
+            foreach ($this->GetSupportedSystems() as $systype) {
+                $os_counts[$systype] = false;
+            }
+
+            // Add in the country type for supported systems
+            for ($j = 0; $j < pg_numrows($os); $j++) {
+                $osname = pg_fetch_result($os, $j, 'operating_system');
+                if (array_key_exists($osname, $os_counts))
+                    $os_counts[$osname] = pg_fetch_result($os, $j, 'count');
+            }
+
+            // Add the country results to the results array
+            $rv[] = array(
+              'country_code' => $data->country_code,
+              'name' => $data->country,
+              'total_count' => $data->count,
+              'percent' => $data->count / $total_systems * 100,
+              'count' => $os_counts);
+        }
+
+        // Return the completed results
+        return $rv;
+    }
+}
+
+?>

Modified: websites/bsdstats.org/bsdstats/bin/start.php
===================================================================
--- websites/bsdstats.org/bsdstats/bin/start.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/bsdstats/bin/start.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -11,17 +11,13 @@
 	 */ 
 	public function __construct(){
 		parent::__construct();
+
+		//assigning common links
+		$this->display->assign('instructions_uri',$this->uri->create_uri(array(TASK_KEY=>'instructions')));
+
+
 		$task = $this->uri->get(TASK_KEY, '');
-		switch($task){
-			case 'update':
-				break;
-			case 'lang':
-				break;
-		}
 
-		$this->ajax	 = isset($_POST['ajax']) || isset($_GET['ajax']);
-		$this->load_library('table_prototype');
-
 		if(!(method_exists($this,'web_'.$task) && is_callable(array($this,'web_'.$task)))){
 			$task = 'home';
 		}
@@ -34,13 +30,48 @@
 		$this->display->show('bsdstats/'.$page);
 		$this->display->end($show_head_foot,'bsdstats');
 	}
+	
+	public function get_list_os(){
+		//maybe have a table with those information in it?
+		return array('FreeBSD',
+					  'DragonFly',
+					  'OpenBSD',
+					  'NetBSD',
+					  'PC-BSD',
+					  'DesktopBSD',
+					  'MidnightBSD',
+					  'MirBSD',
+					  'GNU/kFreeBSD',
+					  );
+	}
 
 	public function web_home(){
-		echo 'here we are at home';
-		return;
-		$this->display->assign('most_download', $this->pbi->get_raw($filters, $order, $group, $limit));
-		$this->display->assign('title', 'Your PC-BSD software');
+		$tmps = $this->db->query('SELECT operating_system, count(1)
+								FROM list_systems ls, 
+									( SELECT id, MAX(report_month) FROM list_systems GROUP BY id ) AS ls2
+								WHERE ls.id = ls2.id
+									AND operating_system IN (\''.implode('\',\'',$this->get_list_os()).'\')
+									AND ls.report_month = ls2.max
+								GROUP BY operating_system
+								ORDER BY count DESC;');
+		
+		$top_os = array();
+		$total = 0;
+		while($tmp = $this->db->fetch_array($tmps)){
+			$total += $tmp['count'];
+			$tmp['image'] = strtolower(str_replace(array('-','/'),'',$tmp['operating_system']));
+			$top_os[] = $tmp;
+		}
+
+		$this->display->assign('top_os', $top_os);
+		$this->display->assign('total', $total);
+		$this->display->assign('title', 'Home');
 		$this->display('home');
 	}
+	
+	public function web_instructions(){
+		$this->display->assign('title', 'Instructions');
+		$this->display('instructions');
+	}
 }
 ?>
\ No newline at end of file

Modified: websites/bsdstats.org/bsdstats/etc/display.conf.php
===================================================================
--- websites/bsdstats.org/bsdstats/etc/display.conf.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/bsdstats/etc/display.conf.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -22,16 +22,14 @@
 $display['meta'][1]['name']			= 'Author';
 $display['meta'][1]['content']		= 'Fabrizio Parrella';
 
-//$display['meta'][2]['name']			= 'Identifier-URL';
-//$display['meta'][2]['content']		= 'http://www.pbidir.com';
 $display['meta'][2]['name']			= 'keywords';
-$display['meta'][2]['content']		= 'pbi, pbidir, software, pcbsd, pc-bsd, freebsd, free, open-source, desktop, operating system, bsd, open source';
+$display['meta'][2]['content']		= 'BSD, FreeBSD, NetBSD, DragonflyBSD, OpenBSD, Usage, Statistics';
 
 $display['meta'][3]['name']			= 'Copyright';
 $display['meta'][3]['content']		= 'Fabrizio Parrella';
 
 $display['meta'][4]['name']			= 'Revisit-after';
-$display['meta'][4]['content']		= '1 day';
+$display['meta'][4]['content']		= '7 days';
 
 $display['meta'][5]['name']			= 'Robots';
 $display['meta'][5]['content']		= 'index, follow';
@@ -39,46 +37,11 @@
 $display['meta'][6]['http-equiv']	= 'imagetoolbar';
 $display['meta'][6]['content']		= 'no';
 
-$display['meta'][7]['name']			= 'description';
-$display['meta'][7]['content']		= 'pbi Directory, where you can find software for your PC-BSD operating system';
-
-
 $display['link'][1]['type']			= 'text/css';
 $display['link'][1]['rel']			= 'stylesheet';
 $display['link'][1]['title']		= 'default';
-$display['link'][1]['href']			= TPLWEBPATH.'css/pbidir.css';
+$display['link'][1]['href']			= TPLWEBPATH.'css/bsdstats.css';
 $display['link'][1]['media']		= 'all';
 
-$display['link'][2]['type']			= 'text/css';
-$display['link'][2]['rel']			= 'stylesheet';
-$display['link'][2]['title']		= 'default';
-$display['link'][2]['href']			= TPLWEBPATH.'css/jquery/ui.tabs.css';
-$display['link'][2]['media']		= 'all';
 
-$display['script'][0]['type']		= 'text/javascript';
-$display['script'][0]['language']	= 'javascript';
-$display['script'][0]['src']		= 'http://code.jquery.com/jquery-latest.js';
-//$display['script'][0]['src']		= TPLWEBPATH.'js/jquery-1.2.1.pack.js';
-//$display['script'][0]['src']		= 'http://code.jquery.com/nightlies/jquery-nightly.pack.js';
-
-$display['script'][1]['type']		= 'text/javascript';
-$display['script'][1]['language']	= 'javascript';
-$display['script'][1]['src']		= TPLWEBPATH.'js/jquery-ui-1.5b3.packed.js';
-
-/*
-$display['script'][1]['type']		= 'text/javascript';
-$display['script'][1]['language']	= 'javascript';
-$display['script'][1]['src']		= TPLWEBPATH.'js/jquery.tablesorter.pack.js';
-*/
-
-/*
-$display['script'][2]['type']		= 'text/javascript';
-$display['script'][2]['language']	= 'javascript';
-$display['script'][2]['src']		= TPLWEBPATH.'js/jquery.tablesorter.pager.js';
-*/
-
-$display['script'][99]['type']		= 'text/javascript';
-$display['script'][99]['language']	= 'javascript';
-$display['script'][99]['src']		= TPLWEBPATH.'js/functions.js';
-
 ?>
\ No newline at end of file

Modified: websites/bsdstats.org/bsdstats/slib/db/pgsql.php
===================================================================
--- websites/bsdstats.org/bsdstats/slib/db/pgsql.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/bsdstats/slib/db/pgsql.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -171,7 +171,7 @@
 
   	function query_first($query_string, $result_type=NULL) {
 		if($this->query($query_string)!=false){			//call the query function
-			$returnarray=$this->fetch_array($this->query_id, $result_type);
+			$returnarray=$this->fetch_array($this->query_id, 0, $result_type);
 			$this->free_result($this->query_id);
 			return $returnarray;
 		} else {
@@ -210,7 +210,7 @@
 		}
 		if($result_type==NULL)	$result_type = $this->default_result_type;
 		if($this->query_id){
-			$this->record = pg_fetch_array($this->query_id, $result_type);
+			$this->record = pg_fetch_array($this->query_id, NULL, $result_type);
 		}else{
 			$this->record = false;
 		}

Modified: websites/bsdstats.org/bsdstats/slib/format.php
===================================================================
--- websites/bsdstats.org/bsdstats/slib/format.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/bsdstats/slib/format.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -33,6 +33,14 @@
 		return number_format($number,$decimal,$this->formats['dec_separator'],$this->formats['thousands_separator']);
 	}
 
+	public function number($number, $decimal=0){
+		return $this->number_format($number,$decimal);
+	}
+
+	public function percent($number, $decimal=0, $percent_sign='%'){
+		return $this->number_format($number,$decimal).$percent_sign;
+	}
+
 	function bytes($bytes){
 		if($bytes==0) return '0 b';
 		if($bytes/1024<1){

Added: websites/bsdstats.org/bsdstats/tpl/bsdstats/foot_menu.php

Added: websites/bsdstats.org/bsdstats/tpl/bsdstats/footer.php

Added: websites/bsdstats.org/bsdstats/tpl/bsdstats/header.php

Added: websites/bsdstats.org/bsdstats/tpl/bsdstats/home.php

Added: websites/bsdstats.org/bsdstats/tpl/bsdstats/instructions.php

Added: websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php

Added: websites/bsdstats.org/bsdstats/tpl/css/bsdstats.css

Added: websites/bsdstats.org/bsdstats/tpl/display/message.php

Modified: websites/bsdstats.org/index.php
===================================================================
--- websites/bsdstats.org/index.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/bsdstats.org/index.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -1,34 +1,33 @@
-<?php
-require_once('BSDSmarty.class.php');
-require_once('Stats/BSDStatsSummary.class.php');
-
-//
-// Retrieve statistics
-//
-
-
-//
-// Display the page
-//  
-$smarty = new BSDSmarty;
-
-// Create a new BSDStats summary object
-$stats = new BSDStatsSummary;
-$smarty->assign_by_ref('stats', $stats);
-
-// Create instances for each OS
-$systems = array();
-foreach ($stats->GetSupportedSystems() as $system) {
-    $system = str_replace('/', '', $system);
-    $system = str_replace('-', '', $system);
-    if (file_exists("/usr/local/www/bsdstats.org/www/_includes/Stats/$system.class.php")) {
-        require_once("Stats/$system.class.php");
-        $class_name = "${system}Stats";
-        $systems[$system] = new $class_name;
-    }
-}
-$smarty->assign_by_ref('systems', $systems);
-
-
-$smarty->display('index.tpl');
-?>
+<?php
+require_once('BSDSmarty.class.php');
+require_once('Stats/BSDStatsSummary.class.php');
+
+//
+// Retrieve statistics
+//
+
+
+//
+// Display the page
+//  
+$smarty = new BSDSmarty;
+// Create a new BSDStats summary object
+$stats = new BSDStatsSummary;
+$smarty->assign_by_ref('stats', $stats);
+
+// Create instances for each OS
+$systems = array();
+foreach ($stats->GetSupportedSystems() as $system) {
+    $system = str_replace('/', '', $system);
+    $system = str_replace('-', '', $system);
+    if (file_exists("/usr/local/www/bsdstats.org/www/_includes/Stats/$system.class.php")) {
+        require_once("Stats/$system.class.php");
+        $class_name = "${system}Stats";
+        $systems[$system] = new $class_name;
+    }
+}
+$smarty->assign_by_ref('systems', $systems);
+
+
+$smarty->display('index.tpl');
+?>

Modified: websites/pbidir.com/.htaccess
===================================================================
--- websites/pbidir.com/.htaccess	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/pbidir.com/.htaccess	2008-06-25 04:52:12 UTC (rev 2170)
@@ -2,7 +2,7 @@
 
 RewriteRule ^rss/recent.rdf$ /bt/rss/pbi.rss [NC,L]
 
-RewriteCond %{REQUEST_URI} !.php|.css|.js|.jpg|.jpeg|.gif|.png|.txt$
+RewriteCond %{REQUEST_URI} !.php|.css|.js|.jpg|.jpeg|.gif|.png|.txt|.sh$
 	RewriteRule ^(.*)$ /index.php/$1 [L]
 
 

Added: websites/pbidir.com/bibivu/slib/db/pgsql.php

Modified: websites/pbidir.com/bibivu/slib/format.php
===================================================================
--- websites/pbidir.com/bibivu/slib/format.php	2008-06-24 21:18:21 UTC (rev 2169)
+++ websites/pbidir.com/bibivu/slib/format.php	2008-06-25 04:52:12 UTC (rev 2170)
@@ -33,6 +33,14 @@
 		return number_format($number,$decimal,$this->formats['dec_separator'],$this->formats['thousands_separator']);
 	}
 
+	public function number($number, $decimal=0){
+		return $this->number_format($number,$decimal);
+	}
+
+	public function percent($number, $decimal=0, $percent_sign='%'){
+		return $this->number_format($number,$decimal).$percent_sign;
+	}
+
 	function bytes($bytes){
 		if($bytes==0) return '0 b';
 		if($bytes/1024<1){



More information about the Commits mailing list