phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpsysinfo phpsysinfo.dtd, NONE, 1.1.2.1 index.php, 1


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] phpsysinfo phpsysinfo.dtd, NONE, 1.1.2.1 index.php, 1.2.2.1, 1.2.2.1.2.1
Date: Sat, 01 Nov 2003 22:08:29 +0000

Update of /cvsroot/phpgroupware/phpsysinfo
In directory subversions:/tmp/cvs-serv22972

Modified Files:
      Tag: Version-0_9_16-branch
        index.php 
Added Files:
      Tag: Version-0_9_16-branch
        phpsysinfo.dtd 
Log Message:
upstream update with a few little mods


--- NEW FILE: phpsysinfo.dtd ---
<!--

  phpSysInfo - A PHP System Information Script
  http://phpsysinfo.sourceforge.net/

  $Id: phpsysinfo.dtd,v 1.1.2.1 2003/11/01 22:08:26 skwashd Exp $

-->
<!ELEMENT phpsysinfo (Generation, Vitals, Network, Hardware, Memory, Swap, 
FileSystem)>
  <!ELEMENT Generation EMPTY>
    <!ATTLIST Generation version CDATA "2.1">
    <!ATTLIST Generation timestamp CDATA "000000000">

  <!ELEMENT Vitals (Hostname, IPAddr, Kernel, Uptime, Users, LoadAvg)>
    <!ELEMENT Hostname (#PCDATA)>
    <!ELEMENT IPAddr (#PCDATA)>
    <!ELEMENT Kernel (#PCDATA)>
    <!ELEMENT Uptime (#PCDATA)>
    <!ELEMENT Users (#PCDATA)>
    <!ELEMENT LoadAvg (#PCDATA)>

  <!ELEMENT Network (NetDevice*)>
    <!ELEMENT NetDevice (Name, RxBytes, TxBytes, Errors, Drops)>
      <!ELEMENT Name (#PCDATA)>
      <!ELEMENT RxBytes (#PCDATA)>
      <!ELEMENT TxBytes (#PCDATA)>
      <!ELEMENT Errors (#PCDATA)>
      <!ELEMENT Drops (#PCDATA)>

  <!ELEMENT Hardware (CPU*, PCI*, IDE*, SCSI*)>
    <!ELEMENT CPU (Number*, Model*, Mhz*, Cache*, Bogomips*)>
      <!ELEMENT Number (#PCDATA)>
      <!ELEMENT Model (#PCDATA)>
      <!ELEMENT Mhz (#PCDATA)>
      <!ELEMENT Cache (#PCDATA)>
      <!ELEMENT Bogomips (#PCDATA)>
    <!ELEMENT PCI (Device*)>
      <!ELEMENT Device (#PCDATA)>
    <!ELEMENT IDE (Device*)>
    <!ELEMENT SCSI (Device*)>

  <!ELEMENT Memory (Free, Used, Total, Percent)>
    <!ELEMENT Free (#PCDATA)>
    <!ELEMENT Used (#PCDATA)>
    <!ELEMENT Total (#PCDATA)>
    <!ELEMENT Percent (#PCDATA)>

  <!ELEMENT Swap (Free, Used, Total, Percent)>

  <!ELEMENT FileSystem (Mount*)>
    <!ELEMENT Mount (MountPoint, Type, Device, Percent, Free, Used, Size)>
      <!ELEMENT MountPoint (#PCDATA)>
      <!ELEMENT Type (#PCDATA)>
      <!ELEMENT Size (#PCDATA)>

Index: index.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpsysinfo/index.php,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.1.2.1
diff -C2 -d -r1.2.2.1 -r1.2.2.1.2.1
*** index.php   24 Nov 2002 22:19:42 -0000      1.2.2.1
--- index.php   1 Nov 2003 22:08:26 -0000       1.2.2.1.2.1
***************
*** 1,79 ****
  <?php
!   /**************************************************************************\
!   * phpGroupWare - PHPSysInfo                                                *
!   * http://www.phpgroupware.org                                              *
!   * --------------------------------------------                             *
!   *  This program is free software; you can redistribute it and/or modify it *
!   *  under the terms of the GNU General Public License as published by the   *
!   *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
!   \**************************************************************************/
! 
!   /* $Id$ */
! 
!       $GLOBALS['phpgw_info']['flags'] = array
!               (
!                       'currentapp' => 'phpsysinfo'
!               );
!       include('../header.inc.php');
  
!       $lng = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
!       $template = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'];
  
!       // default to english, but this is negotiable.
!       if (!(isset($lng) && file_exists('includes/lang/' . $lng . '.php')))
        {
!               $lng = 'en';
        }
!       require('includes/lang/' . $lng . '.php');  // get our language include
!       require('includes/color_scheme.php');        // our default color scheme
!       #require('includes/class.Template.inc.php');  // template library
!       require('includes/system_functions.php');    // finish defining all of 
our global functions and variables
! 
!       // figure out if we got a template passed in the url
!       if (!(isset($template) && file_exists("templates/$template/box.tpl")))
        {
!               // default template we should use if we don't get a argument.
!               $template = 'idsociety';
        }
!       define('TEMPLATE_SET', $template);
  
!       // fire up the template engine
!       $tpl = new Template(dirname(__FILE__) . '/templates/' . TEMPLATE_SET);
!       $tpl->set_file(array(
!               'form' => 'form.tpl'
!       ));
  
!       // print out a box of information
!       function makebox ($title, $content)
!       {
!               $t = new Template(dirname(__FILE__) . '/templates/' . 
TEMPLATE_SET);
  
!               $t->set_file(array(
!                       'box'  => 'box.tpl'
!               ));
  
!               $t->set_var('title', $title);
!               $t->set_var('content', $content);
  
!               return $t->parse('out', 'box');
!       }  
  
!       // let the page begin.
!       #require('includes/system_header.php');
  
!       $tpl->set_var('title', $text['title'] . ': ' . sys_chostname() . ' (' . 
sys_ip_addr() . ')');
!       require('includes/table_vitals.php');
!       require('includes/table_network.php');    
!       require('includes/table_hardware.php');
!       require('includes/table_memory.php');
!       require('includes/table_filesystems.php');
  
!       // parse our the template
!       $tpl->pparse('out', 'form');
  
!       // finally our print our footer
!       #require('includes/system_footer.php');
  
-       $GLOBALS['phpgw']->common->phpgw_footer();
  ?>
--- 1,211 ----
  <?php
! //
! // phpSysInfo - A PHP System Information Script
! // http://phpsysinfo.sourceforge.net/
! //
! // This program is free software; you can redistribute it and/or
! // modify it under the terms of the GNU General Public License
! // as published by the Free Software Foundation; either version 2
! // of the License, or (at your option) any later version.
! //
! // This program is distributed in the hope that it will be useful,
! // but WITHOUT ANY WARRANTY; without even the implied warranty of
! // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! // GNU General Public License for more details.
! //
! // You should have received a copy of the GNU General Public License
! // along with this program; if not, write to the Free Software
! // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
! //
! // $Id$
! //
  
! // our version number
! $VERSION="2.1";
  
! // reassign HTTP variables (incase register_globals is off)
! if (!empty($_GET) && is_array($_GET))
! {
!       foreach($_GET as $name => $value)
        {
!               $$name = $value;
        }
! }
! if (!empty($_POST) && @is_array($_POST))
! {
!       foreach($_POST as $name => $value)
        {
!               $$name = $value;
        }
! }
  
! // Check to see if where running inside of phpGroupWare
! if (isset($sessionid) && $sessionid && $kp3 && $domain)
! {
!     define('PHPGROUPWARE', 1);
!     $phpgw_info['flags'] = array(
!         'currentapp' => 'phpsysinfo',
!     );
!     include_once('../header.inc.php');
! }
! else
! {
!     define('PHPGROUPWARE', 0);
! }
  
! define('APP_ROOT', dirname(__FILE__));
  
! // check to see if we have a random template first
! if (isset($template) && $template == 'random') {
!     $dir = opendir('templates/');
!     while (($file = readdir($dir))!=false) {
!         if ($file != 'CVS' && $file != '.' && $file != '..') {
!             $buf[] = $file;
!         }
!     }
!     $template = $buf[array_rand($buf, 1)];
!     $random = True;
! }
  
! // figure out if we got a template passed in the url
! if (!((isset($template) && file_exists("templates/$template")) || $template 
== 'xml')) {
!     // default template we should use if we don't get a argument.
!     $template = 'classic';
! }
  
! define('TEMPLATE_SET', $template);
  
! // get our current language
! // default to english, but this is negotiable.
! if (!(isset($lng) && file_exists('./includes/lang/' . $lng . '.php'))) {
!     $lng = 'en';
!     // see if the browser knows the right languange.
!     if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
!         $plng = split(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
!         if(count($plng) > 0) {
!             while(list($k,$v) = each($plng)) {
!                 $k = split(';', $v, 1);
!                 $k = split('-', $k[0]);
!                 if(file_exists('./includes/lang/' . $k[0] . '.php')) {
!                     $lng = $k[0];
!                     break;
!                 }
!             }
!         }
!     }
! }
  
! include_once('./includes/lang/' . $lng . '.php');   // get our language 
include
  
! // Figure out which OS where running on, and detect support
! if (file_exists(dirname(__FILE__) . '/includes/os/class.' . PHP_OS . 
'.inc.php')) {
!     include_once('./includes/os/class.' . PHP_OS . '.inc.php');
!     $sysinfo = new sysinfo;
! } else {
!     echo '<center><b>Error: ' . PHP_OS . ' is not currently 
supported</b></center>';
!     exit;
! }
  
! include_once('./includes/common_functions.php'); // Set of common functions 
used through out the app
! include_once('./includes/xml/vitals.php');
! include_once('./includes/xml/network.php');
! include_once('./includes/xml/hardware.php');
! include_once('./includes/xml/memory.php');
! include_once('./includes/xml/filesystems.php');
! 
! $xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
! $xml .= "<!DOCTYPE phpsysinfo SYSTEM \"phpsysinfo.dtd\">\n\n";
! $xml .= created_by();
! $xml .= "<phpsysinfo>\n";
! $xml .= "  <Generation version=\"$VERSION\" timestamp=\"" . time() . "\"/>\n";
! $xml .= xml_vitals();
! $xml .= xml_network();
! $xml .= xml_hardware();
! $xml .= xml_memory();
! $xml .= xml_filesystems();
! $xml .= "</phpsysinfo>";
! 
! 
! if ($template == 'xml') {
!     // just printout the XML and exit
!     print $xml;
! } else {
!     // If they have GD complied into PHP, find out the height of the image to 
make this cleaner
!     if (function_exists('getimagesize') && $template != 'xml') {
!         $image_prop = getimagesize(APP_ROOT . '/templates/' . TEMPLATE_SET . 
'/images/bar_middle.gif');
!         define('BAR_HEIGHT', $image_prop[1]);
!         unset($image_prop);
!     } else {
!         // Until they complie GD into PHP, this could look ugly
!         define('BAR_HEIGHT', 16);
!     }
! 
!     // Store the current template name in a cookie, set expire date to one 
month later
!     // Store 'random' if we want a random template
!     $tpl = (!$random ? $template : 'random');
!     
!     if (!PHPGROUPWARE)
!     {
!         setcookie('template', $tpl, (time() + 2592000));
!     }
!     elseif(PHPGROUPWARE && @$GLOBALS['phpgw_info']['server']['use_cookies'])
!     {
!       $GLOBALS['phpgw']->session->phpgw_setcookie('template', $tpl, (time() + 
2592000));
!     }
!     elseif(PHPGROUPWARE)
!     {
!       $GLOBALS['phpgw']->session->appsession('template', 'phpsysinfo', $tpl);
!     }
! 
!     if (PHPGROUPWARE != 1) {
!         include_once('./includes/class.Template.inc.php');  // template 
library
!     }
! 
!     // fire up the template engine
!     $tpl = new Template(APP_ROOT . '/templates/' . TEMPLATE_SET);
!     $tpl->set_file(array(
!         'form' => 'form.tpl'
!     ));
! 
!     // print out a box of information
!     function makebox ($title, $content) {
!         $t = new Template(dirname(__FILE__) . '/templates/' . TEMPLATE_SET);
! 
!         $t->set_file(array(
!             'box'  => 'box.tpl'
!         ));
! 
!         $t->set_var('title', $title);
!         $t->set_var('content', $content);
! 
!         return $t->parse('out', 'box');
!     }
! 
!     // Fire off the XPath class
!     include_once('./includes/XPath.class.php');
!     $XPath = new XPath();
!     $XPath->importFromString($xml);
! 
!     // let the page begin.
!     include_once('./includes/system_header.php');
! 
!     $tpl->set_var('title', $text['title'] . ': ' . 
$XPath->getData('/phpsysinfo/Vitals/Hostname') . ' (' . 
$XPath->getData('/phpsysinfo/Vitals/IPAddr') . ')');
! 
!     $tpl->set_var('vitals', makebox($text['vitals'], html_vitals(), '100%'));
!     $tpl->set_var('network', makebox($text['netusage'], html_network(), 
'100%'));
!     $tpl->set_var('hardware', makebox($text['hardware'], html_hardware(), 
'100%'));
!     $tpl->set_var('memory', makebox($text['memusage'], html_memory(), 
'100%'));
!     $tpl->set_var('filesystems', makebox($text['fs'], html_filesystems(), 
'100%'));
! 
!     // parse our the template
!     $tpl->pparse('out', 'form');
! 
!     // finally our print our footer
!     if (PHPGROUPWARE == 1) {
!         $phpgw->common->phpgw_footer();
!     } else {
!         include_once('./includes/system_footer.php');
!     }
! }
  
  ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]