Ticket #4401: dashboard-phpsysinfo.patch

File dashboard-phpsysinfo.patch, 8.5 kB (added by ianf, 2 years ago)
  • phpsysinfo/class.Darwin.inc.php

    old new  
    8585    $results = array(); 
    8686    $s = $this->grab_ioreg('IOPCIDevice'); 
    8787 
    88     $lines = split("\n", $s); 
     88    $lines = preg_split("/\n/", $s); 
    8989    for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    9090      $ar_buf = preg_split("/\s+/", $lines[$i], 19); 
    9191      $results[$i] = $ar_buf[0]; 
     
    9999    // ioreg | grep "Media  <class IOMedia>" 
    100100    $s = $this->grab_ioreg('IOATABlockStorageDevice');  
    101101 
    102     $lines = split("\n", $s); 
     102    $lines = preg_split("/\n/", $s); 
    103103    $j = 0; 
    104104    for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    105105      $ar_buf = preg_split("/\/\//", $lines[$i], 19); 
     
    118118    $results['ram'] = array(); 
    119119 
    120120    $pstat = execute_program('vm_stat'); // use darwin's vm_stat 
    121     $lines = split("\n", $pstat); 
     121    $lines = preg_split("/\n/", $pstat); 
    122122    for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    123123      $ar_buf = preg_split("/\s+/", $lines[$i], 19); 
    124124 
     
    138138    $results['ram']['percent'] = round(($results['ram']['used'] * 100) / $results['ram']['total']);  
    139139    // need to fix the swap info... 
    140140    $pstat = execute_program('swapinfo', '-k'); 
    141     $lines = split("\n", $pstat); 
     141    $lines = preg_split("/\n/", $pstat); 
    142142 
    143143    for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    144144      $ar_buf = preg_split("/\s+/", $lines[$i], 6); 
     
    160160 
    161161  function network () { 
    162162    $netstat = execute_program('netstat', '-nbdi | cut -c1-24,42- | grep Link'); 
    163     $lines = split("\n", $netstat); 
     163    $lines = preg_split("/\n/", $netstat); 
    164164    $results = array(); 
    165165    for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    166166      $ar_buf = preg_split("/\s+/", $lines[$i]); 
     
    186186 
    187187  function filesystems () { 
    188188    $df = execute_program('df', '-k'); 
    189     $mounts = split("\n", $df); 
     189    $mounts = preg_split("/\n/", $df); 
    190190    $fstype = array(); 
    191191 
    192192    $s = execute_program('mount'); 
  • phpsysinfo/class.HP-UX.inc.php

    old new  
    6161  }  
    6262 
    6363  function users () { 
    64     $who = split('=', execute_program('who', '-q')); 
     64    $who = preg_split('/=/', execute_program('who', '-q')); 
    6565    $result = $who[1]; 
    6666    return $result; 
    6767  }  
     
    167167        }  
    168168 
    169169        if ($device) { 
    170           list($key, $value) = split(': ', $buf, 2); 
     170          list($key, $value) = preg_split('/: /', $buf, 2); 
    171171 
    172172          if (!preg_match('/bridge/i', $key) && !preg_match('/USB/i', $key)) { 
    173173            $results[] = preg_replace('/\([^\)]+\)\.$/', '', trim($value)); 
     
    241241      foreach( $bufe as $buf ) { 
    242242        if (preg_match('/Vendor/', $buf)) { 
    243243          preg_match('/Vendor: (.*) Model: (.*) Rev: (.*)/i', $buf, $dev); 
    244           list($key, $value) = split(': ', $buf, 2); 
     244          list($key, $value) = preg_split('/: /', $buf, 2); 
    245245          $dev_str = $value; 
    246246          $get_type = 1; 
    247247          continue; 
     
    277277        }  
    278278 
    279279        if ($devstring) { 
    280           list($key, $value) = split(': ', $buf, 2); 
    281           list($key, $value2) = split('=', $value, 2); 
     280          list($key, $value) = preg_split('/: /', $buf, 2); 
     281          list($key, $value2) = preg_split('/=/', $value, 2); 
    282282          $results[$devnum] .= " " . trim($value2); 
    283283          $devstring = 0; 
    284284        }  
     
    297297 
    298298  function network () { 
    299299    $netstat = execute_program('netstat', '-ni | tail -n +2'); 
    300     $lines = split("\n", $netstat); 
     300    $lines = preg_split("/\n/", $netstat); 
    301301    $results = array(); 
    302302    for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    303303      $ar_buf = preg_split("/\s+/", $lines[$i]); 
     
    355355          // Get info on individual swap files 
    356356    $swaps = rfts( '/proc/swaps' ); 
    357357    if( $swaps != "ERROR" ) { 
    358             $swapdevs = split("\n", $swaps); 
     358            $swapdevs = preg_split("/\n/", $swaps); 
    359359 
    360360            for ($i = 1, $max = (sizeof($swapdevs) - 1); $i < $max; $i++) { 
    361361              $ar_buf = preg_split('/\s+/', $swapdevs[$i], 6); 
     
    376376 
    377377  function filesystems () { 
    378378    $df = execute_program('df', '-kP'); 
    379     $mounts = split("\n", $df); 
     379    $mounts = preg_split("/\n/", $df); 
    380380    $fstype = array(); 
    381381 
    382382    $s = execute_program('mount', '-v'); 
     
    384384 
    385385    $i = 0; 
    386386    while (list(, $line) = each($lines)) { 
    387       $a = split(' ', $line); 
     387      $a = preg_split('/ /', $line); 
    388388      $fsdev[$a[0]] = $a[4]; 
    389389    }  
    390390 
  • phpsysinfo/class.NetBSD.inc.php

    old new  
    5252  function network () { 
    5353    $netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"'); 
    5454    $netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep "^[a-z]*[0-9][ \t].*Link"'); 
    55     $lines_b = split("\n", $netstat_b); 
    56     $lines_n = split("\n", $netstat_n); 
     55    $lines_b = preg_split("/\n/", $netstat_b); 
     56    $lines_n = preg_split("/\n/", $netstat_n); 
    5757    $results = array(); 
    5858    for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) { 
    5959      $ar_buf_b = preg_split("/\s+/", $lines_b[$i]); 
  • phpsysinfo/class.OpenBSD.inc.php

    old new  
    5454  function network () { 
    5555    $netstat_b = execute_program('netstat', '-nbdi | cut -c1-25,44- | grep Link | grep -v \'* \''); 
    5656    $netstat_n = execute_program('netstat', '-ndi | cut -c1-25,44- | grep Link | grep -v \'* \''); 
    57     $lines_b = split("\n", $netstat_b); 
    58     $lines_n = split("\n", $netstat_n); 
     57    $lines_b = preg_split("/\n/", $netstat_b); 
     58    $lines_n = preg_split("/\n/", $netstat_n); 
    5959    $results = array(); 
    6060    for ($i = 0, $max = sizeof($lines_b); $i < $max; $i++) { 
    6161      $ar_buf_b = preg_split("/\s+/", $lines_b[$i]); 
  • phpsysinfo/class.SunOS.inc.php

    old new  
    2727  // Extract kernel values via kstat() interface 
    2828  function kstat ($key) { 
    2929    $m = execute_program('kstat', "-p d $key"); 
    30     list($key, $value) = split("\t", trim($m), 2); 
     30    list($key, $value) = preg_split("/\t/", trim($m), 2); 
    3131    return $value; 
    3232  }  
    3333 
     
    6767  }  
    6868 
    6969  function users () { 
    70     $who = split('=', execute_program('who', '-q')); 
     70    $who = preg_split('/=/', execute_program('who', '-q')); 
    7171    $result = $who[1]; 
    7272    return $result; 
    7373  }  
     
    128128    $results = array(); 
    129129 
    130130    $netstat = execute_program('netstat', '-ni | awk \'(NF ==10){print;}\''); 
    131     $lines = split("\n", $netstat); 
     131    $lines = preg_split("/\n/", $netstat); 
    132132    $results = array(); 
    133133    for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    134134      $ar_buf = preg_split("/\s+/", $lines[$i]); 
     
    199199 
    200200  function filesystems () { 
    201201    $df = execute_program('df', '-k'); 
    202     $mounts = split("\n", $df); 
     202    $mounts = preg_split("/\n/", $df); 
    203203 
    204204    $dftypes = execute_program('df', '-n'); 
    205     $mounttypes = split("\n", $dftypes); 
     205    $mounttypes = preg_split("/\n/", $dftypes); 
    206206 
    207207    for ($i = 1, $j = 0, $max = sizeof($mounts); $i < $max; $i++) { 
    208208      $ar_buf = preg_split('/\s+/', $mounts[$i], 6); 
    209       $ty_buf = split(':', $mounttypes[$i-1], 2); 
     209      $ty_buf = preg_split('/:/', $mounttypes[$i-1], 2); 
    210210 
    211211      if (hide_mount($ar_buf[5])) { 
    212212        continue; 
  • phpsysinfo/class.parseProgs.inc.php

    old new  
    1010  $results = array(); 
    1111 
    1212        if ($_results = execute_program('lspci', '', $this->debug)) { 
    13       $lines = split("\n", $_results); 
     13      $lines = preg_split("/\n/", $_results); 
    1414      for ($i = 0, $max = sizeof($lines); $i < $max; $i++) { 
    1515    list($addr, $name) = explode(' ', trim($lines[$i]), 2); 
    1616    //if (!preg_match('/bridge/i', $name) && !preg_match('/USB/i', $name)) {