[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/System/includes/mb/ -> class.hwsensors.inc.php (source)

   1  <?php 
   2  
   3  // phpSysInfo - A PHP System Information Script
   4  // http://phpsysinfo.sourceforge.net/
   5  
   6  // This program is free software; you can redistribute it and/or
   7  // modify it under the terms of the GNU General Public License
   8  // as published by the Free Software Foundation; either version 2
   9  // of the License, or (at your option) any later version.
  10  
  11  // This program is distributed in the hope that it will be useful,
  12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  // GNU General Public License for more details.
  15  
  16  // You should have received a copy of the GNU General Public License
  17  // along with this program; if not, write to the Free Software
  18  // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19  
  20  // $Id: class.hwsensors.inc.php,v 1.3 2004/10/30 08:09:27 webbie Exp $
  21  
  22  class mbinfo {
  23      var $lines;
  24  
  25    function temperature() {
  26      $ar_buf = array();
  27      $lines = array();
  28      $results = array();
  29  
  30      if (!isset($this->lines) ) {
  31          $this->lines = execute_program('sysctl', '-w hw.sensors');
  32      }
  33  
  34      $lines = explode("\n", $this->lines);
  35  
  36      for ($i = 0, $j = 0, $max = sizeof($lines); $i < $max; $i++) {
  37        $ar_buf = preg_split("/[\s,]+/", $lines[$i]);
  38  
  39        if ($ar_buf[2] == 'temp') {
  40          $results[$j]['label'] = $ar_buf[1];
  41          $results[$j]['value'] = $ar_buf[3];
  42          $results[$j]['limit'] = '70.0';
  43          $results[$j]['percent'] = $results[$j]['value'] * 100 / $results[$j]['limit'];
  44          $j++;
  45        }
  46      }
  47  
  48      return $results;
  49    } 
  50  
  51    function fans() {
  52      $ar_buf = array();
  53      $lines = array();
  54      $results = array();
  55  
  56      if (!isset($this->lines) ) {
  57          $this->lines = execute_program('sysctl', '-w hw.sensors');
  58      }
  59  
  60      $lines = explode("\n", $this->lines);
  61  
  62      for ($i = 0, $j = 0, $max = sizeof($lines); $i < $max; $i++) {
  63        $ar_buf = preg_split("/[\s,]+/", $lines[$i]);
  64  
  65        if ($ar_buf[2] == 'fanrpm') {
  66          $results[$j]['label'] = $ar_buf[1];
  67          $results[$j]['value'] = $ar_buf[3];
  68          $j++;
  69        }
  70      }
  71  
  72      return $results;
  73    } 
  74  
  75    function voltage() {
  76      $ar_buf = array();
  77      $lines = array();
  78      $results = array();
  79  
  80      if (!isset($this->lines) ) {
  81          $this->lines = execute_program('sysctl', '-w hw.sensors');
  82      }
  83  
  84      $lines = explode("\n", $this->lines);
  85  
  86      for ($i = 0, $j = 0, $max = sizeof($lines); $i < $max; $i++) {
  87        $ar_buf = preg_split("/[\s,]+/", $lines[$i]);
  88  
  89        if ($ar_buf[2] == 'volts_dc') {
  90          $results[$j]['label'] = $ar_buf[1];
  91          $results[$j]['value'] = $ar_buf[3];
  92          $results[$j]['min'] = '0.00';
  93          $results[$j]['max'] = '0.00';
  94          $j++;
  95        }
  96      }
  97  
  98      return $results;
  99    } 
 100  } 
 101  
 102  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7