[ 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/xml/ -> vitals.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: vitals.php,v 1.27 2005/12/31 17:25:26 bigmichi1 Exp $
  21  
  22  // xml_vitals()
  23  
  24  function xml_vitals ()
  25  {
  26    global $sysinfo;
  27    global $loadbar;
  28  
  29    $load_avg = "";
  30    $ar_buf = ($loadbar ? $sysinfo->loadavg($loadbar) : $sysinfo->loadavg());
  31  
  32    for ($i = 0; $i < count($ar_buf['avg']); $i++) {
  33      $load_avg .= $ar_buf['avg'][$i] . ' ';
  34    } 
  35  
  36    $_text = "  <Vitals>\n"
  37     . "    <Hostname>" . htmlspecialchars($sysinfo->chostname(), ENT_QUOTES) . "</Hostname>\n"
  38     . "    <IPAddr>" . htmlspecialchars($sysinfo->ip_addr(), ENT_QUOTES) . "</IPAddr>\n"
  39     . "    <Kernel>" . htmlspecialchars($sysinfo->kernel(), ENT_QUOTES) . "</Kernel>\n"
  40     . "    <Distro>" . htmlspecialchars($sysinfo->distro(), ENT_QUOTES) . "</Distro>\n"
  41     . "    <Distroicon>" . htmlspecialchars($sysinfo->distroicon(), ENT_QUOTES) . "</Distroicon>\n"
  42     . "    <Uptime>" . htmlspecialchars($sysinfo->uptime(), ENT_QUOTES) . "</Uptime>\n"
  43     . "    <Users>" . htmlspecialchars($sysinfo->users(), ENT_QUOTES) . "</Users>\n"
  44     . "    <LoadAvg>" . htmlspecialchars(trim($load_avg), ENT_QUOTES) . "</LoadAvg>\n";
  45     if (isset($ar_buf['cpupercent']))
  46       $_text .= "   <CPULoad>" . htmlspecialchars(round($ar_buf['cpupercent'], 2), ENT_QUOTES) . "</CPULoad>";
  47     $_text .= "  </Vitals>\n";
  48    return $_text;
  49  } 
  50  
  51  // html_vitals()
  52  
  53  function html_vitals ()
  54  {
  55    global $webpath;
  56    global $XPath;
  57    global $text;
  58  
  59    $textdir = direction();
  60    $scale_factor = 2;
  61    $loadbar = "";
  62    $uptime = "";
  63    
  64    if($XPath->match("/phpsysinfo/Vitals/CPULoad"))
  65      $loadbar = "<br/>" . create_bargraph($XPath->getData("/phpsysinfo/Vitals/CPULoad"), 100, $scale_factor) . "&nbsp;" . $XPath->getData("/phpsysinfo/Vitals/CPULoad") . "%";
  66  
  67    $_text = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\" "
  68       . "  <tr>\n"
  69       . "    <td width=20% align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['hostname'] . "</font></td>\n"
  70       . "    <td width=80% class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Hostname") . "</font></td>\n"
  71       . "  </tr>\n"
  72       . "  <tr>\n"
  73       . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['ip'] . "</font></td>\n"
  74       . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/IPAddr") . "</font></td>\n"
  75       . "  </tr>\n"
  76       . "  <tr>\n"
  77       . "    <td align=right  class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['kversion'] . "</font></td>\n"
  78       . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Kernel") . "</font></td>\n"
  79       . "  </tr>\n"
  80       . "  <tr>\n"
  81       . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['dversion'] . "</font></td>\n"
  82       . "    <td class=\"cellText small\"><img width=\"16\" height=\"16\" alt=\"\" src=\"/modules/System/images/" . $XPath->getData("/phpsysinfo/Vitals/Distroicon") . "\">&nbsp;<font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Distro") . "</font></td>\n"
  83       . "  </tr>\n"
  84       . "  <tr>\n"
  85       . "    <td align=right  class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['uptime'] . "</font></td>\n"
  86       . "    <td class=\"cellText small\"><font size=\"-1\">" . uptime($XPath->getData('/phpsysinfo/Vitals/Uptime')) . "</font></td>\n"
  87       . "  </tr>\n"
  88       . "  <tr>\n"
  89       . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['users'] . "</font></td>\n"
  90       . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/Users") . "</font></td>\n"
  91       . "  </tr>\n"
  92       . "  <tr>\n"
  93       . "    <td align=right class=\"cellLabel small\" valign=\"top\"><font size=\"-1\">" . $text['loadavg'] . "</font></td>\n"
  94       . "    <td class=\"cellText small\"><font size=\"-1\">" . $XPath->getData("/phpsysinfo/Vitals/LoadAvg") . $loadbar . "</font></td>\n"
  95       . "  </tr>\n"
  96       . "</table>\n";
  97  
  98    return $_text;
  99  } 
 100  
 101  function wml_vitals ()
 102  {
 103    global $XPath;
 104    global $text;
 105    
 106    $_text = "<card id=\"vitals\" title=\"" . $text['vitals']  . "\">\n"
 107           . "<p>" . $text['hostname'] . ":<br/>\n"
 108        . "- " . $XPath->getData("/phpsysinfo/Vitals/Hostname") . "</p>\n"
 109       . "<p>" . $text['ip'] . ":<br/>\n"
 110       . "- " . $XPath->getData("/phpsysinfo/Vitals/IPAddr") . "</p>\n"
 111       . "<p>" . $text['kversion'] . ":<br/>\n"
 112       . "- " . $XPath->getData("/phpsysinfo/Vitals/Kernel") . "</p>\n"
 113       . "<p>" . $text['uptime'] . ":<br/>\n"
 114       . "- " . uptime($XPath->getData('/phpsysinfo/Vitals/Uptime')) . "</p>"
 115       . "<p>" . $text['users'] . ":<br/>"
 116       . "- " . $XPath->getData("/phpsysinfo/Vitals/Users") . "</p>"
 117       . "<p>" . $text['loadavg'] . ":<br/>"
 118       . "- " . $XPath->getData("/phpsysinfo/Vitals/LoadAvg") . "</p>"
 119       . "</card>\n";
 120  
 121    return $_text;
 122  }
 123  ?>


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