' . '' . ''; } else if ($percent < 90) { return '' . '' . ''; } else { return '' . '' . ''; } } // Execute a system function. Do path checking // return a trim()'d result. function execute_program ($program, $args) { $path = array( '/bin/', '/sbin/', '/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin'); $buffer = ''; while ($this_path = current($path)) { if (is_executable("$this_path/$program")) { if ($fp = popen("$this_path/$program $args", 'r')) { while (!feof($fp)) { $buffer .= fgets($fp, 4096); } return trim($buffer); } } next($path); } } // function that emulate the compat_array_keys function of PHP4 // for PHP3 compatability function compat_array_keys ($arr) { $result = array(); while (list($key, $val) = each($arr)) { $result[] = $key; } return $result; } // function that emulates the compat_in_array function of PHP4 // for PHP3 compatability function compat_in_array ($value, $arr) { while (list($key,$val) = each($arr)) { if ($value == $val) { return true; } } return false; } // A helper function, when passed a number representing KB, // and optionally the number of decimal places required, // it returns a formated number string, with unit identifier. function format_bytesize ($kbytes, $dec_places = 2) { global $text; if ($kbytes > 1048576) { $result = sprintf('%.' . $dec_places . 'f', $kbytes / 1048576); $result .= ' '.$text['gb']; } elseif ($kbytes > 1024) { $result = sprintf('%.' . $dec_places . 'f', $kbytes / 1024); $result .= ' '.$text['mb']; } else { $result = sprintf('%.' . $dec_places . 'f', $kbytes); $result .= ' '.$text['kb']; } return $result; } ?>